Skip to content

fix: prevent duplicated UpdateFunction calls#10759

Open
IzaakGough wants to merge 6 commits into
mainfrom
@invertase/fix-prevent-duplicated-update-function-calls
Open

fix: prevent duplicated UpdateFunction calls#10759
IzaakGough wants to merge 6 commits into
mainfrom
@invertase/fix-prevent-duplicated-update-function-calls

Conversation

@IzaakGough

@IzaakGough IzaakGough commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #10731

Summary

Prevent Cloud Functions update requests from enabling the premature-close retry path, which could cause duplicate UpdateFunction calls.

Problem/Root Cause

PATCH update requests were eligible for the keep-alive retry path when a premature-close error occurred. For Cloud Functions updates, that could reissue the operation and produce duplicate update calls.

Solution/Changes

Add a per-request retryOnPrematureClose flag to the API client and disable it for Cloud Functions v1 and v2 update calls. Update the request tests to cover both the disabled and default retry behavior.

Testing

  • Added unit coverage for the premature-close retry path in src/apiv2.spec.ts.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request restricts retrying requests on premature close errors to specific HTTP methods by introducing a helper function, and adds corresponding unit tests. The review feedback correctly notes that the helper function is named isIdempotentMethod but includes POST, which is non-idempotent. It suggests renaming the function to shouldRetryMethod to maintain semantic correctness.

Comment thread src/apiv2.ts Outdated
Comment thread src/apiv2.ts Outdated
@IzaakGough
IzaakGough marked this pull request as ready for review July 3, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cloud Functions v2: firebase deploy sends UpdateFunction twice in one deploy; duplicate fails with 409 ABORTED "unable to queue the operation"

2 participants