Skip to content

Transactions that experience errors never resolve #9147

Open
@sjudd

Description

@sjudd

Operating System

OSX / Windows

Environment (if applicable)

Chrome / Safari

Firebase SDK Version

10.7.1

Firebase SDK Product(s)

Firestore

Project Tooling

React app

Detailed Problem Description

If you reject inside a firestore transaction, it never resolves. This means the error can't be caught or reported. If you're not careful about how you design your app, it can become effectively disabled.

Steps and code to reproduce issue

Here's a minimal way I was able to reproduce this:

await runTransaction(firestore, async (transaction) => {
    await Promise.reject();
});

This produces this in the logs:

firebase_firestore.js?v=219e9f8d:14764 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'name')
    at __PRIVATE_TransactionRunner.tu (firebase_firestore.j…v=219e9f8d:14764:31)
    at __PRIVATE_TransactionRunner.eu (firebase_firestore.j…v=219e9f8d:14761:25)
    at firebase_firestore.j…v=219e9f8d:14748:14

Then the await on runTransaction blocks forever.

it's highly unfortunate that runTransaction doesn't throw an exception for this kind of error. Because it doesn't throw, reasonable error handling won't catch it and it can't easily be reported via a tool like Sentry.

This is actually impacting real users. I've seen this behavior several times for users on spotty connections. For those users, the transaction never finishes and I see FirebaseError: internal somewhere in the logs with no additional details. I can't be 100% certian that it's the same issue, but it certainly seems likely.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions