Next.js Discord

Discord Forum

Getting the weird error when deploying the nextjs14 application to the vercel (screenshot attached)

Answered
Spid€r posted this in #help-forum
Open in Discord
![image](https://github.com/vercel/community/assets/115649011/f31ec7af-6e60-4b73-8b0c-1182dc06fd9e)

im using nextj14, prisma and nextauth for the authentication

the codebase [link ](https://github.com/spider076/Cedium)

please help me solve this weird bug

### Example

No response

### Steps to Reproduce

the deployed application link : [https://cedium.vercel.app/](https://cedium.vercel.app/)

these are the website vercel logs :

![image](https://github.com/vercel/community/assets/115649011/63e81966-9bab-4915-96ab-2da0c1063c57)
Answered by joulev
Do not fetch your own route handlers in server components. https://nextjs-faq.com/fetch-api-in-rsc
View full answer

28 Replies

@Spid€r all env's are well connected
try to build your project locally using vercel build and vercel start Let's see, if there are errors as well
@Spid€r Click to see attachment
the Database_url contains no variables, right?
@B33fb0n3 the Database_url contains no variables, right?
it contains neon db's postgress connection url
yup tq for the assistance
solved this error by following this : https://next-auth.js.org/configuration/options
the error still persist 😢
the website content appears for a micro second and the same error comes back
have also wrapped the page with suspense component
this is the errror in my vercel dashboard logs :
Answer
but i dont see this errors on running vercel build command
@joulev Do not fetch your own route handlers in server components. <https://nextjs-faq.com/fetch-api-in-rsc>
you mean like : ?
@Spid€r you mean like : ?
Yes. Don’t do this.
a'right got it
gotta follow the docs u provided, will update if it succeds
@Spid€r you mean like : ?
i can do this on my client component right ?
Yes, though you won’t need to use the domain in that case. Just fetch("/api/…") already works.

If you find yourself doing fetch("http://localhost:3000/…") you are likely doing it wrong.
here im not directly using the fetch to retrive the blogs in the ListBlogs function, im calling it outside of the function
does this also cause error ? i found in an youtube video that this is best approach to call any api from the server component
@Spid€r does this also cause error ? i found in an youtube video that this is best approach to call any api from the server component
That YouTube video is just plain wrong. The error you are encountering is a proof of that. Don’t trust everything you see on YouTube.

Refactor your code so that you don’t fetch() your own route handlers. Just run the server side logic directly.