"Fetch failed" error in production mode
Unanswered
Ojos Azules posted this in #help-forum
Ojos AzulesOP
My Fullstack app with prisma and postgress works in localhost but when i upload to vercel doesnt work, fetch failed
27 Replies
@Ojos Azules My Fullstack app with prisma and postgress works in localhost but when i upload to vercel doesnt work, fetch failed
you need to show some code
but it's likely that you did something like
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-componentsOjos AzulesOP
yes i have fetch("/api/user")
yes then that doesn't work, see the linked page for more information
@joulev yes then that doesn't work, see the linked page for more information
Ojos AzulesOP
if i do this i will get error like Prisma cant run on this browser something like that
@Ojos Azules Click to see attachment
this must be in a server component for it to work
Ojos AzulesOP
Yes but for this component what's the solution ?
use a structure similar to this https://nextjs-forum.com/post/1121791826521768079#message-1121796826023067808
you fetch the data in a component and render it in another
@Ojos Azules Yes but for this component what's the solution ?
this file works fine though because it is a client component so
/api/getBarbers is available when it is runthe file that caused the error is a different file
@joulev use a structure similar to this https://discord.com/channels/752553802359505017/1121791826521768079/1121796826023067808
Ojos AzulesOP
Yes i did that and if you remember i had this problem and i could solve it
@joulev the file that caused the error is a different file
Ojos AzulesOP
what file you think?
@Ojos Azules Yes i did that and if you remember i had this problem and i could solve it
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
Ojos AzulesOP
do you want repo?
reproduction repository that can reproduce this problem
Ojos AzulesOP
i dont how to do this :/
@joulev https://stackoverflow.com/help/minimal-reproducible-example
Ojos AzulesOP
So do you want code snippets?
@Ojos Azules 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 onWell 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
Ojos AzulesOP
@joulev if you want a call to help me out with this issue i will appreciate it