firebase-admin-node: Missing Exports
[READ] Step 1: Are you in the right place?
- For issues related to the code in this repository file a Github issue.
- If the issue pertains to Cloud Firestore, read the instructions in the “Firestore issue” template.
- For general technical questions, post a question on StackOverflow with the firebase tag.
- For general Firebase discussion, use the firebase-talk google group.
- For help troubleshooting your application that does not fall under one of the above categories, reach out to the personalized Firebase support channel.
[REQUIRED] Step 2: Describe your environment
- Operating System version: Linux 5.13.0
- Firebase SDK version: 10.1.0
- Firebase Product: all, basically (auth, database, storage, etc)
- Node.js version: 16.14.0
- NPM version: 8.4.1
[REQUIRED] Step 3: Describe the problem
There are certain files that aren’t listed in the exports
key in the package.json
. Namely everything in the utils
folder, as I realized that the FirebaseAuthError
is only exported by the utils/error.js
file, and is nowhere in the Auth namespace. This makes it very difficult to deal with errors in TypeScript, as the usual checking with instanceof
can’t work without the exported class.
Not sure if the fix is to make the utils
folder “public”, or to just reexport the contained classes in the correct namespaces.
Also, the utils
folder only exists under the CommonJS build, and not the ESM directory.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 19
- Comments: 16
This needs to be exported asap. Error handling with admin SDK is a nightmare.
Any updates on this issue? On Typescript, unable properly catch FirebaseAuthError type exceptions.
Any update?
My approach was to use a type guard:
usage:
This syntax works fine (example), as opposed to importing from
firebase-admin
:Having the same issue, can’t use
instanceof
forFirebaseError
. Temporary hacky workaround that seems to be working for my use case iserr?.name === 'FirebaseError'