Skip to content

Commit

Permalink
docs: add wait-until non streaming (#11739)
Browse files Browse the repository at this point in the history
Co-authored-by: Tom Lienard <tom.lienrd@gmail.com>
  • Loading branch information
Kikobeats and QuiiBz committed Jun 17, 2024
1 parent 545f117 commit fec617c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions errors/wait-until-non-streaming.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# The waitUntil API has limited support for non-streaming functions

## Why This Warning Occurred

The [waitUntil](https://vercel.com/docs/functions/functions-api-reference#waituntil) method allows you to enqueue asynchronous tasks to be performed during the lifecycle of the request, and these tasks can continue to resolve even after the response has been written.

This is possible because `waitUntil` takes advantage of [streaming functions](https://vercel.com/docs/functions/streaming#streaming-functions).

When `waitUntil` is used in a non-streaming function, the behavior is limited and the response is delayed to be written after the enqueued asynchronous tasks have been resolved.

## How to Fix It

To take advantage of waitUntil without compromise, all you have to do is explicitly opt-in your functions to support streaming:

```js
export const config = {
supportsResponseStreaming: true,
};
```

0 comments on commit fec617c

Please sign in to comment.