The generic adapter's fetch always replaces request.waitUntil with its own implementation (Object.defineProperties(request, { waitUntil: ... })), even when the request already has one. When the generic adapter wraps a handler on a platform like Cloudflare or Vercel, the platform's waitUntil is lost and promises go to an internal set that nothing awaits.
import { serve } from "srvx/generic";
const server = serve({ fetch: () => new Response("ok") });
const req = new Request("http://localhost/");
req.waitUntil = (p) => platformContext.waitUntil(p);
await server.fetch(req);
req.waitUntil; // generic adapter's waitUntil, not the platform one
Nitro hit this while applying server entry middleware/plugins on serverless presets (nitrojs/nitro#4620 follow-up). The suggested fix is to only define waitUntil when the request does not already have one.
Reported with AI assistance.
The generic adapter's
fetchalways replacesrequest.waitUntilwith its own implementation (Object.defineProperties(request, { waitUntil: ... })), even when the request already has one. When the generic adapter wraps a handler on a platform like Cloudflare or Vercel, the platform'swaitUntilis lost and promises go to an internal set that nothing awaits.Nitro hit this while applying server entry
middleware/pluginson serverless presets (nitrojs/nitro#4620 follow-up). The suggested fix is to only definewaitUntilwhen the request does not already have one.Reported with AI assistance.