Enabling i18n causes ISR to break
See original GitHub issueIssue Summary
ISR stopped working for me on a recent deploy. One of the new features I added was using next.js’s i18n localization. On a bit of a whim, I decided to remove it and redeploy, and now ISR is working again.
Maybe something to do with the Accept Language header being part of the CloudFront cache key when localization is enabled? Or something to do with the localized subpathing (though I only had a single en localization and I was accessing it without a subpath and still had the issue).
I noticed all my x-cache response headers were misses from CloudFront.
Steps to reproduce
For me, adding the following to my next.config.js
caused this behaviour:
i18n: {
locales: ['en'],
defaultLocale: 'en',
localeDetection: false,
},
Screenshots/Code/Configuration/Logs
This happened a few days ago, and I’m going through the CloudWatch Logs but I don’t actually see any errors on this day in either the Default or Regeneration lambdas.
Versions
- OS/Environment: Runs in GitHub Actions on Ubuntu latest
- @sls-next/serverless-component version: 3.2.0
- Next.js version: 11
Additional context
I would like to spend more time debugging this, but as localization isn’t needed for our initial MVP, I can’t yet justify the time now that I have a workaround that works. However, I still wanted to post the issue in case someone else is having issues with ISR and realises that maybe this is the cause. I may be able to look more into this in the future when we need to start adding localized content.
On the initial issue I commented on, @dphang had this remark
hm yes there is not good e2e test coverage for i18n locales yet, it might be that the path is not translated correctly to hit the regeneration lambda (and save the new page)
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top GitHub Comments
No worries! It was a legitimate bug so the report is still useful 😄
Thank you for fixing this! Sorry I wasn’t able to be of more help.