Next.js Discord

Discord Forum

Failed to collect page data for API route

Unanswered
Common Pochard posted this in #help-forum
Open in Discord
Common PochardOP
Deploying a nextjs App router application to cloudflare workers was working fine until I added API route.

https://github.com/vercel/next.js/discussions/78294

note: the build succeeds locally, only fails in cloudflare

Any help is appreciated.

1 Reply

Common PochardOP
it boilded down to process.env not being available right away, I had code that was exposing a variable as singleton, when it was moved to the method call it worked.