-
Notifications
You must be signed in to change notification settings - Fork 370
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
Firebase Admin 12.1.1 issue with error.ts #2571
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
We are also experiencing this and there doesn't seem to be a good option for mocking this to avoid the problem. |
Same issue here trying to mock
Looking at the commits between 12.1.0 and 12.1.1, there were a couple of changes related to error classes, but nothing stands out to me as an obvious cause: |
Glad I'm not the only one. I didn't find an obvious culprit but making the message part optional does allow mocking to work, which seems to me like some firebase error classes are instanciated without a defined message error, like
|
Thanks for reporting this. Does optional chaining (see below) fix the issue for you? If that's the case then I can prepare a fix in the SDK. firebase-admin-node/src/utils/error.ts Line 61 in e2515f2
/** @returns The error code. */
public get code(): string {
return this.errorInfo?.code;
}
/** @returns The error message. */
public get message(): string {
return this.errorInfo?.message;
} |
It does for me. That's how I fixed it internally. |
#2581 should fix it, but if you can provide us with a minimal repro that would be very useful for us to investigate and confirm the fix. Thanks! |
Thanks @lahirumaramba . Here's a minimal reproduction case with 12.1.1: https://stackblitz.com/edit/firebase-admin-node-2571?file=test%2Fbasic.test.ts If you edit |
I also tested the PR with our project and it works fine! |
Thanks @jbaldassari for the repro! I really appreciate it. |
Hi @lahirumaramba , any eta for the release? We've been holding out from upgrading to 12.1.1 for about 2 weeks now. |
We will include this in the release next week. Thanks for your patience! |
The fix is now released in |
Thank you! I'm deploying to staging, and will probably push this onto prod on Monday. We've been really looking forward the updated firestore library to see if it stabilizes our issues. |
[READ] Step 1: Are you in the right place?
template.
with the firebase tag.
google group.
of the above categories, reach out to the personalized
Firebase support channel.
[REQUIRED] Step 2: Describe your environment
[REQUIRED] Step 3: Describe the problem
Upgraded a (mature) codebase from 12.1.0 to 12.1.1, unit tests will no longer pass.
Narrowed down the issue to src/utils/error.ts line 62
If I add an optional to errorInfo?.message, and the tests pass now.
This file hasn't changed in over 3 years according to the github history, so the fact that it's failing now might be related to something introduced in 12.1.1, probably #2151
Steps to reproduce:
Upgrade to 12.1.1, and write a simple test using jest.
Note I am using pnpm, but the error also occurs if you use npm:
at FirebaseError.get message [as message] (../node_modules/.pnpm/[email protected]/node_modules/firebase-admin/lib/utils/error.js:46:31)
at Array.forEach ()
at Array.forEach ()
at Array.forEach ()
at Object. (../node_modules/.pnpm/[email protected][email protected]/node_modules/firebase-functions/lib/common/providers/firestore.js:25:19)
at Object. (../node_modules/.pnpm/[email protected][email protected]/node_modules/firebase-functions/lib/v2/providers/firestore.js:32:21)
at Object. (../node_modules/.pnpm/[email protected][email protected]/node_modules/firebase-functions/lib/v2/index.js:56:19)
Relevant Code:
/** @returns The error message. */
public get message(): string {
return this.errorInfo.message;
}
The text was updated successfully, but these errors were encountered: