Skip to content

feat(functions): add request cancellation to invoke via abortSignal - #1593

Merged
spydon merged 2 commits into
mainfrom
lukasklingsbo/sdk-1310-featfunctions-request-cancellation-for-invoke-flutter-sdk
Jul 15, 2026
Merged

spydon merged 2 commits into
mainfrom
lukasklingsbo/sdk-1310-featfunctions-request-cancellation-for-invoke-flutter-sdk

Conversation

@spydon

@spydon spydon commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds request cancellation to FunctionsClient.invoke, closing the gap versus the canonical compliance matrix. invoke now accepts an optional abortSignal Future; completing it cancels the in-flight HTTP request and throws RequestAbortedException, mirroring how the database client exposes cancellation through PostgrestBuilder.abortSignal.

This is done idiomatically with the http package's AbortableRequest/AbortableMultipartRequest (wiring abortTrigger), so it works for both regular and multipart invocations. RequestAbortedException is re-exported from the package so callers can catch it.

A per-invocation timeout is now expressible as invoke(..., abortSignal: Future.delayed(duration)), so the previously not_applicable functions.invocation.timeout note is updated accordingly.

Outcome

implemented

Reference

Mirrors the existing Dart database.using_modifiers.request_cancellation idiom (PostgrestBuilder.abortSignal).

Compliance matrix

  • functions.invocation.request_cancellation → implemented (symbol FunctionsClient.invoke registered)

Tests

  • Aborting an in-flight request throws RequestAbortedException
  • Aborting a multipart request throws RequestAbortedException
  • A never-firing signal lets the request complete normally

SDK-1310

Wire an abortSignal Future through FunctionsClient.invoke so callers can cancel an in-flight request the idiomatic Dart way, mirroring PostgrestBuilder.abortSignal. Completing the future aborts the underlying HTTP request and throws RequestAbortedException.

Implements functions.invocation.request_cancellation.

SDK-1310
@spydon
spydon requested a review from a team as a code owner July 13, 2026 14:29
@github-actions github-actions Bot added the functions This issue or pull request is related to functions label Jul 13, 2026
@spydon
spydon merged commit b994dab into main Jul 15, 2026
30 checks passed
@spydon
spydon deleted the lukasklingsbo/sdk-1310-featfunctions-request-cancellation-for-invoke-flutter-sdk branch July 15, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions This issue or pull request is related to functions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants