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

Bug: on-demand revalidation showing one step old stale data #131

Closed
surjithctly opened this issue Dec 12, 2022 · 9 comments
Closed

Bug: on-demand revalidation showing one step old stale data #131

surjithctly opened this issue Dec 12, 2022 · 9 comments

Comments

@surjithctly
Copy link

surjithctly commented Dec 12, 2022

I'm using the api/revalidate to update content. But each time it updates, it returns one step old data. Not fresh.

I'm tried using bothuseCdn: true & false, but same result. Here, the webhook fires immediately after publishing, but apicdn takes upto 60 sec to update the content. Thus Next.js getting old data each time.

See below video.

Video transcription:

Starts next production builds
change “first post” to “Our first post”
Simulate “webhook” requests
Data do not change

[next attempt]
change “Our first post” to “Next first post”
Data change to Stale “Our First post” this time
but new data is “Next First Post” (edited)

CleanShot.2022-12-12.at.20.07.48-converted.mp4
@surjithctly
Copy link
Author

Are you able to reproduce this bug? @stipsan

@stipsan
Copy link
Member

stipsan commented Dec 26, 2022

The revalidate function isn't designed to be used with useCdn. It should be false 🤔

@surjithctly
Copy link
Author

Tried with both true & false. But same result.

@stipsan
Copy link
Member

stipsan commented Dec 26, 2022

If you can share a link to the repo I could give it a look?

@surjithctly
Copy link
Author

Sure. here it is: https://github.com/surjithctly/jamstack-starter

@stipsan
Copy link
Member

stipsan commented Dec 26, 2022

Thnx, I'm on the go right now and couldn't see anything out of the ordinary when browsing your code saw. Back home I'll investigate on my laptop and see what's going on

@surjithctly
Copy link
Author

Thank you, I even tried adding a delay of 5 seconds in revalidate.ts, but that also did not help.

@surjithctly
Copy link
Author

Damn! just realized I still had useCdn true for frontend, false was only applied for revalidate. 🤦‍♂️

It does seems to work now. ✅

Thanks a lot for the help. You may close this issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 28, 2022
@stipsan
Copy link
Member

stipsan commented Dec 30, 2022

Great to hear you figured it out @surjithctly! 😌 There's some more information on how the revalidation works in this thread: #97 (comment)

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

No branches or pull requests

2 participants