Next.js Discord

Discord Forum

Prevent Static Pages when Building

Unanswered
New Zealand posted this in #help-forum
Open in Discord
New ZealandOP
Hi! I'm running into several issues between my dev and production environments.

For my site, I'm opting into client-side rendering by placing "use client"; at the top of all of my pages. This works perfectly when I'm running next using npm run dev, but I'm running into issues in production.

When I go directly to a URL (/client), without first being redirected, I'm getting a page that looks like this, with no HTML.

My build succeeds and shows that the /client page is a static page, even though it should not be. Only static pages (with the circle) are giving me this issue, while the pages with the lambda next to them work fine. I resolved this issue on the backend by removing the NextResponse import, which was causing static rendering on my API endpoints.

None of my pages use any of the built-in getStaticProps, etc. Each page imports SWR, react, and other internal components.

5 Replies

New ZealandOP
This does not happen every time I visit the page directly, and seemingly randomly appears for different users on different pages. It shows up more frequently longer after the last build.