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

await fetch cache set dangling promise #736

Open
dario-piotrowicz opened this issue Feb 11, 2025 · 0 comments
Open

await fetch cache set dangling promise #736

dario-piotrowicz opened this issue Feb 11, 2025 · 0 comments

Comments

@dario-piotrowicz
Copy link
Contributor

Next.js sets values in the incremental cache for fetch calls: https://github.com/vercel/next.js/blob/e5fc495e3d4/packages/next/src/server/lib/patch-fetch.ts#L690-L728

The issue here is that this promise is never awaited in the Next.js code (since in a standard node.js server
the promise will eventually simply just run) but when run in a Cloudflare worker it should be run it inside waitUntil
(so that the worker is not killed before the promise is fully executed), without that this promise gets discarded and values
don't get saved in the incremental cache.

Some patch should be applied here so that the dangling promise is instead properly awaited, the same has been done
in the Cloudflare adapter here: opennextjs/opennextjs-cloudflare#364
(the same sort of fix should be applied here and opennextjs/opennextjs-cloudflare#364 reverted since the cloudflare adatper will simply inherit the patch)


original discussion

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