The Deploy documentation does not contain any warnings not to perform work in the background after a response has been returned from a handler. I have tried this in a test app and it appears to work. But in other serverless environments it is forbidden and works intermittently or not at all.
Here's an example of what I mean:
Deno.serve((req) => {
// initiate an async request, which will complete after response is returned.
// We do not want to block the client response, and we don't care about retrying
// if the request fails
asyncRequestToLoggingService(req);
return new Response(getResponseBody(req));
});
For context, the above pattern will not work reliably in Lambda, Netlify Functions or Vercel Functions, and requires modification (explicit use of context.waitUntil) to work reliably in CloudFlare Workers or Vercel Edge Functions.
Can the docs clarify whether Deno has the unique ability to do this kind of background processing in a serverless environment, or whether it is unreliable/forbidden?
Steps to reproduce
n/a
Expected behavior
Docs should provide clarity on whether all processing must be completed by the time that the response is returned
Problem description
The Deploy documentation does not contain any warnings not to perform work in the background after a response has been returned from a handler. I have tried this in a test app and it appears to work. But in other serverless environments it is forbidden and works intermittently or not at all.
Here's an example of what I mean:
For context, the above pattern will not work reliably in Lambda, Netlify Functions or Vercel Functions, and requires modification (explicit use of
context.waitUntil
) to work reliably in CloudFlare Workers or Vercel Edge Functions.Can the docs clarify whether Deno has the unique ability to do this kind of background processing in a serverless environment, or whether it is unreliable/forbidden?
Steps to reproduce
n/a
Expected behavior
Docs should provide clarity on whether all processing must be completed by the time that the response is returned
Environment
No response
Possible solution
No response
Additional context
No response