denoland / denoland/deploy_feedback

[Bug]: Docs do not provide clarity on whether asynchronous work can reliably complete after a response is returned

Open
#660 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
79
Forks
5
PR merge metrics
No merged PRs in 30d

Description

### 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:

```js
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

### Environment

_No response_

### Possible solution

_No response_

### Additional context

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.