Next.js Discord

Discord Forum

Static page build on app directory doesn't work

Unanswered
California pilchard posted this in #help-forum
Open in Discord
California pilchardOP
So I have .env with auth token from my CMS so that I can generate pages dynamically on build and I hope to build them statically. However, I tried to remove the .env file before running next start and everything just break. Why is this?

14 Replies

if it is a dynamic page, you probably need to add generateStaticParams and export const dynamicParams = false to those pages
@joulev can you check if the build log shows a circle (static page) or a greek character (dynamic page)?
California pilchardOP
Hello, thank you for the quick answer, all of them are static pages
The problem still persist.
After build, I removed the .env file, and the "statically build pages" are broken with error not finding the authentication code for the CMS graphql query. Also...
California pilchardOP
@joulev Yes
@California pilchard <@484037068239142956> Yes
Well… you have revalidate there which I do believe is part of the issue. When the thing is run again after a revalidation period, it will need the credentials
Try removing it
California pilchardOP
wait hold on,..
@joulev yeah I still get Authentication failed
This is my graphcms client
Yeah then I don’t know, sorry
@joulev Yeah then I don’t know, sorry
California pilchardOP
I wonder if I should create a ticket on github for this?
Well, I don’t know. I cannot verify that this is a next bug or your code bug