-
Notifications
You must be signed in to change notification settings - Fork 375
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
admin.credential.cert Invalid or unexpected token #2276
Comments
I found a few problems with this issue:
|
Hey @tom-andersen this could be related to the multidb feature. Could you take a look when you have a moment? Thanks! |
Hey @folmosr what version of |
Hey @lahirumaramba , I'm using these 2 packages @firebase/firestore 4.0.0, I've taken @firebase/firestore to version 4.1.1 but I'm still having the same issue |
Hey @lahirumaramba. The problem looks to be related to parsing the following line:
This might have something to do with the version of NodeJS. the ``??` operator requires v14 or higher. |
In my Docker file I'm using node:18-alpine and locally Node v16.20.0 |
Hey @lahirumaramba I tested this packed but I ended up getting the same result, now I can see there is a new version of firebase-admin, I'll test this version and I will let you know how it goes, thanks. |
I am having the same issue when I go to use any Admin SDK function after initializing with a service account. Code works fine with v10.3.0 but fails with all v11 and v12 that I have tried. The same issue is detailed in this SO post, including my comments from today. With v11.11.1 I get this exception:
Note I am running my code as ESM yet I see the error above mentions UPDATE This seems to be an ESM vs CJS issue. My code runs as ESM (it is an older codebase using Trying to build a repro is proving challenging....the issue goes away with a clean codebase and nice/proper handling of ESM. The code works fine with v10, v11 and v12 in this configuration. |
Hello! I have absolutely the same issue. |
@iaroslav-ianishyn by "ESM" I mean that my code base is now using "type: module" in package.json and all my code uses ESM syntax (e.g. |
I took this package to the latest version 11.10.1, I always use this variation to connect to the database
admin.initializeApp({ credential: admin.credential.cert({ 'projectId': '----', 'privateKey': '-----BEGIN PRIVATE KEY-----\n....\n-----END PRIVATE KEY-----\n', 'clientEmail': '[email protected]', }), databaseURL:
https://pickapp-cl-qa-279013.firebaseio.com`,});`
but now It's throwing this exception
const initialSettings = this.firestoreSettings.get(databaseId) ?? {}; SyntaxError: Invalid or unexpected token at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
I have tested this from version 11.3.0 and below and it works as expected
The text was updated successfully, but these errors were encountered: