fix(functions): add configurable timeout and normalize abort/timeout errors as FunctionsFetchError #1837
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🔍 Description
This PR addresses issue #1399 by adding a configurable client-side timeout for Functions invocations and by normalizing abort/timeouts into a typed FunctionsFetchError. Callers can now increase the client timeout when calling
supabaseClient.functions.invoke(...)and reliably detect timeout/abort failures across environments.What changed?
supabaseClient.functions.invoke('fn-name', { /* ... */, timeout: <number in ms> })FunctionsFetchErrorwith a standardized kind (e.g."timeout"or"abort").Why was this change needed?
Issue #1399 reported that long-running edge functions were being cut off by a hard 60s client timeout and users had no way to increase it. Adding a user-configurable timeout fixes that UX gap. At the same time, different environments surface abort/timeouts with different error shapes (DOMException, AbortError, etc.), which makes it hard to handle these failures consistently. Normalizing those into FunctionsFetchError with an explicit kind gives consumers a single, stable error to catch and inspect.
Closes #1399
📝 Additional notes