How to completely opt out of pre-rendering for route handlers #50656
Replies: 4 comments
-
Oddly enough, this was causing my |
Beta Was this translation helpful? Give feedback.
-
That is definitely not the way we should have to do that ---_--- |
Beta Was this translation helpful? Give feedback.
-
I have the same question and no idea why this is the default behaviour |
Beta Was this translation helpful? Give feedback.
-
I'm using this: /**
* Check if code is running as a result of `next build`
*/
export function isNextBuild() {
// eslint-disable-next-line turbo/no-undeclared-env-vars
return process.env["NEXT_PHASE"] === "phase-production-build";
} That's probably not a "public API" so could break in future but good enough for me. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I currently have the following in a route handler, which is a webhook handler for an api (there is no react, it takes in a body, does something, returns success/fail as json).
Under no circumstances do I want something like this being executed at bulid time, yet I can't see a 'good way' of stopping it, outside of moving it into the pages directly.
I've tried force dynamic and the other options (shown here), but when doing npm run build, it's still trying to execute the code.
Am I missing something obvious?
it would be lovely to have like
as an eject.
As an aside, there was nothing in the docs about how to parse form data, only json bodys. So I had to figure that out on my own.
Beta Was this translation helpful? Give feedback.
All reactions