You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provide an ambient AbortController via an API to server actions and a method for cancelling a request.
Use Case
Users may wish to cancel and retry long-running AI requests, especially in streaming and langchain-esque scenarios where completion times are on the order of tens of seconds or longer.
Additional context
Attempting to work around the issue by, e.g., passing a Promise to the server action does not work, as Next.js delays calling the server action while the promise resolves. This can be demonstrated by calling a server action with new Promise<void>((r) => setTimeout(r, 10_000)) and logging the un-awaited value of the promise immediately in the action.
Feature Description
Provide an ambient
AbortController
via an API to server actions and a method for cancelling a request.Use Case
Users may wish to cancel and retry long-running AI requests, especially in streaming and langchain-esque scenarios where completion times are on the order of tens of seconds or longer.
Additional context
Attempting to work around the issue by, e.g., passing a Promise to the server action does not work, as Next.js delays calling the server action while the promise resolves. This can be demonstrated by calling a server action with
new Promise<void>((r) => setTimeout(r, 10_000))
and logging the un-awaited value of the promise immediately in the action.Related issues:
The text was updated successfully, but these errors were encountered: