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]: NextJS fetch cache context lost when loading other edge routes #535

Closed
1 task
tills13 opened this issue Nov 10, 2023 · 3 comments · Fixed by #536
Closed
1 task

[🐛 Bug]: NextJS fetch cache context lost when loading other edge routes #535

tills13 opened this issue Nov 10, 2023 · 3 comments · Fixed by #536
Labels
bug Something isn't working

Comments

@tills13
Copy link

tills13 commented Nov 10, 2023

next-on-pages environment related information

System:
Platform: linux
Arch: x64
Version: #1 SMP Fri Jan 27 02:56:13 UTC 2023
CPU: (12) x64 13th Gen Intel(R) Core(TM) i7-1365U
Memory: 15 GB
Shell: /bin/bash
Package Manager Used: npm (9.8.1)

Relevant Packages:
@cloudflare/next-on-pages: 0.0.0-4572873 (beta/canary release)
vercel: N/A
next: 13.5.6

Description

I'm not 100% sure of the conditions required, but it seems like if you have a sever action, and another edge worker script is loaded in a worker, the AsyncLocalStorage context NextJS uses internally on fetch in the first edge worker is lost resulting in the following error when using revalidatePath or revalidateTag

Error: Invariant: static generation store missing in revalidateTag _N_T_/

This same behaviour happens in a production pages environment so it's not limited to Miniflare / this project.

Reproduction

https://github.com/tills13/next-on-pages-bug

Reproduction

  1. npx --no-install @cloudflare/next-on-pages
  2. npx wrangler d1 execute todos --local --file schema.sql
  3. npx wrangler pages dev .vercel/output/static --compatibility-flag=nodejs_compat
  4. go to http://localhost:8788
  5. try to create a todo using the form

Pages Deployment Method

Pages CI (GitHub/GitLab integration)

Pages Deployment ID

I can DM you a larger app I have that exhibits this same behaviour lmk if you want that

Additional Information

No response

Would you like to help?

  • Would you like to help fixing this bug?
@james-elicx
Copy link
Contributor

I was going to post here last night asking you to try the prerelease, but GitHub was having issues and took too long to start the workflow checks before I went to sleep. I just wanted to say thank you very much for providing a reproduction as it was very helpful when trying to find a fix :)

@tills13
Copy link
Author

tills13 commented Nov 11, 2023

I was desperate as this not getting fixed would mean having to use vercel instead of cloudflare. Really appreciate you taking the time. Glad I could help.

I looked around briefly but couldn't find one -- do you have a tip jar / buy-me-a-coffee link?

@james-elicx
Copy link
Contributor

I was desperate as this not getting fixed would mean having to use vercel instead of cloudflare. Really appreciate you taking the time. Glad I could help.

I looked around briefly but couldn't find one -- do you have a tip jar / buy-me-a-coffee link?

it's no worries, i don't - you can consider the reproduction to be the tip 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants