Minimal reproduction for a missing waitUntil on the CacheProvider onRequest context.
The route caching docs describe the onRequest context as:
(
context: {
request: Request;
url: URL;
waitUntil?: (promise: Promise<unknown>) => void;
},
next: MiddlewareNext,
) => Promise<Response>;However, waitUntil is:
-
Missing from the type definition in
node_modules/astro/dist/core/cache/types.d.ts:onRequest?(context: { request: Request; url: URL; // waitUntil is not here }, next: MiddlewareNext): Promise<Response>;
-
Absent at runtime —
typeof context.waitUntillogs as"undefined"inside the provider.
This matters for Cloudflare Workers, where cache writes should be handed off via waitUntil so they don't block the response being sent to the client.
astro: 6.1.1@astrojs/cloudflare: 13.1.4
npm i
npm run build
npm run previewOpen or curl your preview, and check the Wrangler console output for:
[repro] typeof context.waitUntil = undefined
typeof context.waitUntil should be "function".