Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

ISR not working when revalidate is less than the SQS 5-minute deduplication interval #2483

@delisdeli

Description

@delisdeli

Issue Summary

Changes to my ISR page take up to 5 minutes to update after the underlying data is changed.

Actual behavior

Let's say I have a user profile page which features a user's user name. This is a ISR powered page with revalidate option set to 1.

  1. I open the page and see the username is delisdeli
  2. I update the username of the user in the DB to newname with a SQL query
  3. I open the page again and see username delisdeli
  4. I immediately open the page again and see username delisdeli <= I would have expected to see newname now
  5. I wait 5 minutes
  6. I open the page again and see username newname

Expected behavior

  1. I open the page and see the username is delisdeli
  2. I update the username of the user in the DB to newname with a SQL query
  3. I open the page again and see username delisdeli
  4. I immediately open the page again and see username newname

Steps to reproduce

See above.

Screenshots/Code/Configuration/Logs

Can add later if needed.

Versions

  • OS/Environment: AWS Lambda Node.js 14.x
  • @sls-next/serverless-component version: 3.6.0
  • Next.js version: 11.1.2

Additional context

I believe the issue is due to SQS deduplication ID being set to the page ETag. Because the ETag will be that of the cached page in S3 and the deduplication ID is the same then SQS will ignore the regeneration messages (even after events are deleted from the queue) due to how SQS deduplication logic works (docs). I have tested setting deduplication id to current time in seconds and the behavior is as expected. Happy to open a PR if this is the right approach.

Code links that show deduplication ID is set to ETag:

eTag: response.headers["etag"]?.[0].value,

Checklist

  • You have reviewed the README and FAQs, which answers several common questions.
  • You have reviewed our DEBUGGING wiki and have tried your best to include complete information and reproduction steps (including your configuration) as is possible. As there is only one maintainer (who maintains this in his free time) and thus very limited resources, if you have time, please try to debug the issue a bit yourself if possible.
  • You have first tried using the most recent latest or alpha @sls-next/serverless-component release version, which may have already fixed your issue or implemented the feature you are trying to use. Note that the old serverless-next.js component and the serverless-next.js plugin are deprecated and no longer maintained.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions