-
-
Notifications
You must be signed in to change notification settings - Fork 456
ISR not working when revalidate is less than the SQS 5-minute deduplication interval #2483
Description
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.
- I open the page and see the username is
delisdeli - I update the username of the user in the DB to
newnamewith a SQL query - I open the page again and see username
delisdeli - I immediately open the page again and see username
delisdeli<= I would have expected to seenewnamenow - I wait 5 minutes
- I open the page again and see username
newname
Expected behavior
- I open the page and see the username is
delisdeli - I update the username of the user in the DB to
newnamewith a SQL query - I open the page again and see username
delisdeli - 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, |
serverless-next.js/packages/libs/lambda-at-edge/src/lib/triggerStaticRegeneration.ts
Line 60 in e6367b5
| MessageDeduplicationId: |
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
latestoralpha@sls-next/serverless-componentrelease version, which may have already fixed your issue or implemented the feature you are trying to use. Note that the oldserverless-next.jscomponent and theserverless-next.jsplugin are deprecated and no longer maintained.