Unable to build NextJS Project due to Api Route.
Answered
Bluetick Coonhound posted this in #help-forum
Bluetick CoonhoundOP
I'm unable to build the project due to an error that says:
eP [Error]: Page withdynamic = "error"couldn't be rendered statically because it usedheaders. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-renderingAnswered by averydelusionalperson
you can deploy without static export too If I'm not wrong
34 Replies
how are you building it?
you can't use static export
since you're using the api, it's server thing
@averydelusionalperson you can't use static export
Bluetick CoonhoundOP
i see, is there a workaround for this?
i've checked the docs and it did say that it's unsupported
I don't think so, you can't use server with static export
if you want static, use vite or smthing IMO
Bluetick CoonhoundOP
Huh, if so, how do people use or deploy projects with Api Routes?
They don't use static export?
They deploy it like a regular node server
since it's technically a node server
Asiatic Lion
why do you need to use static export in api router?
@Asiatic Lion why do you need to use static export in api router?
Bluetick CoonhoundOP
deploying it into Firebase
you can deploy without static export too If I'm not wrong
Answer
@averydelusionalperson you can deploy without static export too If I'm not wrong
Asiatic Lion
I also think so
Bluetick CoonhoundOP
really? Give me a moment 

Asiatic Lion

Bluetick CoonhoundOP
i was able to build it without problems but this is what it showed me when i used npm start
where did you start this?
are you sure, you got this by running
npm run startBluetick CoonhoundOP
VSCode, using Npm run start
or is npx serve different?
npx serve is different
it's for serving static files
Bluetick CoonhoundOP
ahh, let me re-install the package.json then
Alright, it works now!
Will this work if i deploy it in Firebase as well?
Asiatic Lion
you just need to know how to deploy it
you can mark solution for this question, and open another post if you've any doubts about hosting IMO.
Bluetick CoonhoundOP
I have my deploy commands ready, hopefully it doesn't show what it showed when i used npx
will do if i have any more problems!
Original message was deleted