#"Fetch failed" error in production mode
28 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in <id:customize>
✅ You can mark a message as the answer for your post with `Right click -> Apps -> Mark Solution`
(if you don't see the option, try refreshing Discord with Ctrl + R)
you need to show some code
but it's likely that you did something like fetch("/api/user") in a server component, then it doesn't work because the api route isn't running during build, see https://nextjs-discord-common-questions.joulev.dev/fetching-own-api-endpoint-in-react-server-components
yes then that doesn't work, see the linked page for more information
if i do this i will get error like Prisma cant run on this browser something like that
this must be in a server component for it to work
Yes but for this component what's the solution ?
use a structure similar to this #1121791826521768079 message
you fetch the data in a component and render it in another
this file works fine though because it is a client component so /api/getBarbers is available when it is run
the file that caused the error is a different file
Yes i did that and if you remember i had this problem and i could solve it
what file you think?
oh i see, i forgot that post, sorry about that
give me a repro repo then
i can't say anything from this much information
do you want repo?
reproduction repository that can reproduce this problem
i dont how to do this :/
So do you want code snippets?
you gave me a code snippet and i told you i cannot say anything from it
provide me a minimal reproducible example that i can clone and run npm run dev on
see also #welcome message
Well since you won’t help me help you I won’t be able to help, you need to wait for someone else to come and help