The production build throws error when any page is accessed
Answered
Cuban Crocodile posted this in #help-forum
Cuban CrocodileOP
Hello, we have recently migrated our mern app to nextjs. The dev build works fine but now we are trying to create a standalone production build
The build succeeds and runs with
https://pastebin.com/4qWP9qks
I am having a hard time figuring out where the problem is originating from.
Aside:
- We do have a
- other than that, the project is pretty standard. a couple of pages and layouts linked together and server actions.
What i am expecting to happen is to be redirected to
Any help will be appreciated!
pnpm run build.The build succeeds and runs with
node .next/standalone/server.js but when i try to access it localhost:3000 i receive a 500 | Internal Server Error on the browser and the following trace in the logs:https://pastebin.com/4qWP9qks
I am having a hard time figuring out where the problem is originating from.
Aside:
- We do have a
middleware.ts file that might cause a problem; but the error has no mention of middleware.- other than that, the project is pretty standard. a couple of pages and layouts linked together and server actions.
What i am expecting to happen is to be redirected to
/login and be presented with a login formAny help will be appreciated!
Answered by Cuban Crocodile
apparently one of the fetch call was failing. wish the traceback helped through, but can't complain
5 Replies
Madeiran sardinella
It looks like a problem with headers on any request in middleware or layout.
"Cannot append headers after they are sent to the client"
Maybe you are executing something after response is sent, or sending response twice
Maybe you are executing something after response is sent, or sending response twice
Cuban CrocodileOP
Hmm I'm not sure, if it was our code that was faulty, wouldn't it show up in the backtrace?
Madeiran sardinella
That's all I can say without seeing any piece of code 🤷🏾♂️
Cuban CrocodileOP
apparently one of the fetch call was failing. wish the traceback helped through, but can't complain
Answer