-
Notifications
You must be signed in to change notification settings - Fork 962
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 56ca0e1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Size Report 1Affected Products
Test Logs |
Size Analysis Report 1Affected Products
Test Logs |
Changeset File Check ✅
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise, LGTM
@@ -113,7 +113,7 @@ export class TransactionRunner<T> { | |||
} | |||
|
|||
private isRetryableTransactionError(error: Error): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can make error
an optional param to communicate the behavior we have observed. This also supports the change you made below for future readers.
private isRetryableTransactionError(error?: Error): boolean {...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ultranit: Consider using error: Error | undefined
rather than error?: Error
.
It's somewhat nonsensical to not specify an argument to a function named "isRetryableTransactionError", and defining the parameter as error?: Error
allows nonsensical function invocations like this.
In contrast, specifying the argument as error: Error | undefined
will cause a TypeScript build error if no argument is specified to the function, but will still allow calling it with an explicit undefined
argument.
IMO the latter is the intended use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussion
This pull request resolves a bug where a Firestore transaction would hang indefinitely if an error without a message property was thrown within the transaction's body.
The root cause of this issue was an incorrect assumption in the SDK that an error object would always contain a message. This change corrects the logic to ensure that the SDK can gracefully handle errors that lack a message.
Fixes #9147
Testing
Verify in integration test