-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add wait-until non streaming (#11739)
Co-authored-by: Tom Lienard <tom.lienrd@gmail.com>
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; | ||
``` |