You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{createServerComponentClient}from"@supabase/auth-helpers-nextjs"import{cookies}from"next/headers"import{Database}from"@/interfaces/types_db"constsupabaseServer=()=>{cookies().getAll()// Keep cookies in the JS execution context for Next.js buildreturncreateServerComponentClient<Database>({ cookies })}exportdefaultsupabaseServer
4.Fetch products from DB like this
import{ProductsSkeleton}from"@/components/Skeletons"importsupabaseServerfrom"@/utils/supabaseServer"import{cache}from"react"//get products from cache (check in future if product was edited - do new request to DB)//if no products in cache - fetch from DBconstfetchProducts=cache(async()=>{constproducts=awaitsupabaseServer().from("products").select("*")console.log(9,"products - ",products)if(!products.data)return<div>No products found</div>returnproducts.data})exportdefaultasyncfunctionProducts(){constproducts=awaitfetchProducts()//set individual quantity for each user in updatedProducts variablereturn(<divclassName="mobile:border-[1px] broder-border-color rounded w-full max-w-[1440px] min-w-[80vw]"><divclassName="flex flex-row justify-between px-4"><h1className="hidden tablet:flex text-lg">Products:</h1></div><ulclassName="flex flex-col gap-y-8"></ul></div>)}
5.Get this error
Current vs. Expected behavior
Expecting no error to hapen (or error with more info how to fix it)
But got the error that tells me nothing
I used Vite and on Vite I got not error (but I get worse performance)
useEffect(()=>{asyncfunctionfetchProducts(){try{setIsLoading(true)constresponse=awaitsupabase.from("products").select("*")if(response.error)throwresponse.error//add quantity for each product because (user A quantity - 2 - user B - quantity 3 )constupdatedResponse=response.data.map(product=>{constmatchingProduct=userCartStore.products.find(item=>item.id===product.id)return{
...product,quantity: matchingProduct ? matchingProduct.quantity : 0,}})setProducts(updatedResponse)setIsLoading(false)}catch(error){console.error("fetchProducts - ",error)}}fetchProducts()//eslint-disable-next-line react-hooks/exhaustive-deps},[])
Verify canary release
I verified that the issue exists in the latest Next.js canary release
Provide environment information
pnpx --no-install next info
/media/kali/SSD_256GB/.pnpm-store/v3/tmp/dlx-89331:
ERR_PNPM_FETCH_404 GET https://registry.npmjs.org/--no-install: Not Found - 404
This error happened while installing a direct dependency of /media/kali/SSD_256GB/.pnpm-store/v3/tmp/dlx-89331
--no-install is not in the npm registry, or you have no permission to fetch it.
No authorization header was setfor the request.
Which area(s) are affected? (Select all that apply)
Package manager (npm, pnpm, Yarn)
Additional context
No response
The text was updated successfully, but these errors were encountered:
I would like to add some docs and describe my experience with this error cause not only I expirience this error but now I don't see any link to create page on next js docs
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Link to the code that reproduces this issue
https://github.com/nicitaacom/23_store/blob/sub-root-add-products/app/(site)/components/Products.tsx
To Reproduce
cookies
#566304.Fetch products from DB like this
5.Get this error
Current vs. Expected behavior
Expecting no error to hapen (or error with more info how to fix it)
But got the error that tells me nothing
I used Vite and on Vite I got not error (but I get worse performance)
Verify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
Package manager (npm, pnpm, Yarn)
Additional context
No response
The text was updated successfully, but these errors were encountered: