Wrong warning "You have opted-out of Automatic Static Optimization due to `getInitialProps` in `pages/_app`"
See original GitHub issueBug report
Describe the bug
Warning: You have opted-out of Automatic Static Optimization due to
getInitialProps
inpages/_app
. This does not opt-out pages withgetStaticProps
My _app
contains a commented/disabled getInitialProps
.
// static async getInitialProps(props: AppInitialProps): Promise<AppRenderProps> {
To Reproduce
Use a commented getInitialProps
in _app
Expected behavior
Warning shouldn’t appear when getInitialProps
isn’t actually used
Screenshots
Video (1mn): https://youtu.be/4J6kxF8igIc
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
You have opted-out of Automatic Static Optimization due to ...
Pages with getInitialProps are run on demand. If that happens next.js is not able to perform Automatic Static Optimization.
Read more >opt-out-auto-static-optimization | Next.js
You are using getInitialProps in your Custom <App> . This causes all non-getStaticProps pages to be executed on the server -- disabling Automatic...
Read more >errors/opt-out-auto-static-optimization.md - Next.js - Fossies
Opt-out of Automatic Static Optimization. Why This Warning Occurred. You are using getInitialProps in your Custom <App> . This causes all non-getStaticProps ...
Read more >Query menu with getInitialProps best practice? - Prismic People
When you website is deployed, does vercel need to know which pages are changed from the webhook to use Automatic Static Optimization? because ......
Read more >NextJS - How to Retrieve Values for Meta Tags - Sanity.io
if you just need one set of meta tags, doing this in the _app or _document ... will disable Automatic Static Optimization in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Vadorequest it’s being added by the
withApollo
HOC from thenext-with-apollo
package. As mentioned in the project’s docs if you pass thegetDataFromTree
config it will addgetInitialProps
and opt the pages out of the automatic static optimizationThis issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.