Skip to content

fix(firestore): fix empty message reject inside transaction body #9177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/spotty-bananas-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/firestore': patch
---

Fixed a bug where a rejected promise with an empty message in a transaction would cause a timeout. (https://github.com/firebase/firebase-js-sdk/issues/9147)
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe you can remove this link to the issue, but you need to update your PR description to use this exact syntax:

Fixes: #9147

Then the change log generator will be able to parse this issue number out of the PR description and generate the link for you.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, this would be a "patch", not a "major" bump, right? See line 2.

Copy link
Contributor

@dconeybe dconeybe Jul 25, 2025

Choose a reason for hiding this comment

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

Please also remove the http link and add the line Fixes: #9147 to the PR description. Then the release notes will be automatically populated with the link to the issue. For an example of this, see #9151

4 changes: 2 additions & 2 deletions packages/firestore/src/core/transaction_runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ export class TransactionRunner<T> {
}
}

private isRetryableTransactionError(error: Error): boolean {
if (error.name === 'FirebaseError') {
private isRetryableTransactionError(error?: Error): boolean {
if (error?.name === 'FirebaseError') {
// In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
// non-matching document versions with ABORTED. These errors should be retried.
const code = (error as FirestoreError).code;
Expand Down
13 changes: 13 additions & 0 deletions packages/firestore/test/integration/api/transactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,19 @@ apiDescribe('Database transactions', persistence => {
}
);

it('runTransaction with empty message reject inside', () => {
return withTestDb(persistence, async db => {
try {
await runTransaction(db, () => {
return Promise.reject();
});
expect.fail('transaction should fail');
} catch (err) {
expect(err).to.be.undefined;
}
});
});

describe('must return a promise:', () => {
const noop = (): void => {
/* -_- */
Expand Down
Loading