Skip to content

Commit

Permalink
Polishing the wording for waitUntil non-streaming error (#11740)
Browse files Browse the repository at this point in the history
  • Loading branch information
timeyoutakeit committed Jun 17, 2024
1 parent fec617c commit f219834
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions errors/wait-until-non-streaming.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

## 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.
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).

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.
When `waitUntil` is used in a [non-streaming function](https://vercel.com/docs/functions/streaming#non-streaming-functions), the behavior is limited and the function will delay the response until 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:
To overcome the limitations of `waitUntil` with [non-streaming functions](https://vercel.com/docs/functions/streaming#non-streaming-functions), you should explicitly opt-in your functions to support streaming:

```js
export const config = {
Expand Down

0 comments on commit f219834

Please sign in to comment.