Summary
Implement ISR revalidation for serverless deployments. Currently, NextDeploy detects ISR routes during build but has no runtime revalidation mechanism.
What Is ISR?
Incremental Static Regeneration allows Next.js pages to be statically generated at build time but automatically re-generated in the background after a configured revalidate period.
Required Components
- Centralized S3 cache — Replace Lambda filesystem cache with S3-based cache handler
- SQS FIFO queue — Message queue for revalidation requests
- Revalidation Lambda — Polls SQS, sends HEAD request to trigger page regeneration
- Custom cache handler — Next.js
cacheHandler that reads/writes ISR data from S3
Architecture (inspired by OpenNext)
Request → Server Lambda → Check S3 cache
├── Cache HIT + fresh → Return cached page
├── Cache HIT + stale → Return cached page + queue revalidation via SQS
└── Cache MISS → SSR + write to S3 cache
SQS FIFO Queue → Revalidation Lambda → HEAD request → Re-generates page → Updates S3 cache
Infrastructure to Auto-Provision
- S3 cache bucket (or prefix in existing bucket)
- SQS FIFO queue
- Revalidation Lambda function
- DynamoDB table for cache tags (on-demand revalidation)
References
Difficulty: Hard · Language: Go + JavaScript
Summary
Implement ISR revalidation for serverless deployments. Currently, NextDeploy detects ISR routes during build but has no runtime revalidation mechanism.
What Is ISR?
Incremental Static Regeneration allows Next.js pages to be statically generated at build time but automatically re-generated in the background after a configured
revalidateperiod.Required Components
cacheHandlerthat reads/writes ISR data from S3Architecture (inspired by OpenNext)
Infrastructure to Auto-Provision
References
Difficulty: Hard · Language: Go + JavaScript