Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks done
delisdeli opened this issue Aug 26, 2022 · 2 comments
Open
3 tasks done

Comments

@delisdeli
Copy link

delisdeli commented Aug 26, 2022

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.
@delisdeli
Copy link
Author

This PR fixes the issue: #2486

@delisdeli
Copy link
Author

@dphang @J3tto do you guys mind taking a look to see if it is on the right track or am I misunderstanding the intent behind the current implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant