AWS
Overrides
Revalidation Queue

This override is used by OpenNext to trigger the revalidation of stale routes. Before sending the response to the client, OpenNext will check if the route is stale and if it is, it will call the queue override to revalidate the route.

If you want to better understand how to implement your own Queue, the easiest way would be to take a look at the existing included Queue (opens in a new tab).

Couple of things to note :

  • The default implementation use an SQS queue. This has the main advantage of being able to control the concurrency of the revalidations as well as avoiding trigerring the revalidation multiple times for the same route.
  • You don't have to use a queue at all. You could trigger the revalidation directly in the Queue override itself. You can see a very simple implementation of this in the queue override.

Included Queue

sqs

The SQS Queue will send a message to an SQS queue for each route that needs to be revalidated. It is used by default if you don't provide any Queue in your configuration. It uses the @aws-sdk/client-sqs to interact with SQS.

Requirements

  • You need to provide the QUEUE_URL environment variable to your server.

sqs-lite

The SQSLite Queue will send a message to an SQS queue for each route that needs to be revalidated. This implementation is a lighter version of the sqs Queue as it uses aws4fetch to interact with SQS.

Requirements

  • You need to provide the QUEUE_URL, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN environment variables to your server.

direct

The Direct Queue will directly trigger the revalidation of the route in the Queue override itself. It is useful for development purposes and when you don't want to use a queue.

⚠️

Be careful with this implementation as it could lead to multiple revalidations of the same route.

dummy

The Dummy Queue is a dummy implementation that will throw an exception. It should not be used unless you want to disable ISR.