aws-amplify / aws-amplify/amplify-hosting
Next.JS Fails to Update Prerender Cache with Time-based Revalidation
- Dominant language
- Dockerfile
- Stars
- 481
- Forks
- 123
- PR merge metrics
- No merged PRs in 30d
Description
### Before opening, please confirm:
- [X] I have checked to see if my question is addressed in the [FAQ](https://github.com/aws-amplify/amplify-hosting/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-hosting/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-hosting/blob/master/CONTRIBUTING.md).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
### App Id
d3v90eh9vhzxl4
### AWS Region
us-east-1
### Amplify Hosting feature
SSR
### Frontend framework
Next.js
### Next.js version
13.4.12
### Next.js router
App Router
### Describe the bug
Next.JS is unable to update the prerender cache as part of the incremental site regeneration process. Since the web compute runtime is unable to write out regenerated pages to the filesystem, Amplify continues to serve up stale pages.
### Expected behavior
When specifying a revalidation interval, Amplify web compute regenerates pages based on (re)fetched data and serves the regenerated pages up to visitors based on cache controls.
### Reproduction steps
1. Create a Next.JS application using the app router
2. Enable time-based revalidation (documented [here](https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#time-based-revalidation))
3. Deploy to Amplify
### Build Settings
```yaml
version: 1
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- env | grep -e MY_CREDENTIALS_PREFIX_ >> .env.production
- npm run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
- .next/cache/**/*
```
### Log output
```
Failed to update prerender cache for /my-page [Error: EROFS: read-only file system, open '/tmp/app/.next/server/app/my-page.html'] {
errno: -30,
code: 'EROFS',
syscall: 'open',
path: '/tmp/app/.next/server/app/my-page.html'
}
```
### Additional information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.