Skip to content

ISR (Incremental Static Regeneration) revalidation support #6

@aynaash

Description

@aynaash

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

  1. Centralized S3 cache — Replace Lambda filesystem cache with S3-based cache handler
  2. SQS FIFO queue — Message queue for revalidation requests
  3. Revalidation Lambda — Polls SQS, sends HEAD request to trigger page regeneration
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions