angular-firebase-stripe icon indicating copy to clipboard operation
angular-firebase-stripe copied to clipboard

Error: Error occurred while parsing your function triggers.

Open dhoman opened this issue 5 years ago • 2 comments

Error: Certificate object must contain a string "private_key" property.
    at FirebaseAppError.FirebaseError [as constructor] (/Users/dhoman/Source/stripeDemo/functions/node_modules/firebase-admin/lib/utils/error.js:39:28)
    at FirebaseAppError.PrefixedFirebaseError [as constructor] (/Users/dhoman/Source/stripeDemo/functions/node_modules/firebase-admin/lib/utils/error.js:85:28)
    at new FirebaseAppError (/Users/dhoman/Source/stripeDemo/functions/node_modules/firebase-admin/lib/utils/error.js:119:28)
    at new Certificate (/Users/dhoman/Source/stripeDemo/functions/node_modules/firebase-admin/lib/auth/credential.js:118:19)

I've tried both methods of loading the credientials using

export const stripeSecret       = functions.config().stripe.secret;
export const stripePublishable  = functions.config().stripe.publishable;
export const stripeClientId     = functions.config().stripe.clientid; // only used for stripe connect

and

export const stripeSecret       = serviceAccount.stripe.secret;
export const stripePublishable  = serviceAccount.stripe.publishable;
export const stripeClientId     = serviceAccount.stripe.clientid; 

and neither seem to work, I get the same error.

I know the json file is fine because previously I was getting format errors for my json file and I resolved them.

I know the functions.config() is fine because I verified the values when running "firebase functions:config:get"

I thought it was an issue with the runtime that "firebase deploy --only functions" deploys node is 6 (can't specify the version although you can if you use gcloud cmd line instead), but I'm getting the same error when I try the "npm run serve" command

I'm at my wits end, I think it's an issue with the "Certificate object" being updated and one of the dependencies being a mismatch but idk what.

the package.json file in the functions folder is

  "dependencies": {
    "cors": "^2.8.4",
    "express": "^4.16.2",
    "firebase-admin": "^6.0.0",
    "firebase-functions": "^2.0.4",
    "request": "^2.83.0",
    "request-promise": "^4.2.2",
    "stripe": "^5.4.0"
  },

dhoman avatar Aug 14 '18 08:08 dhoman

also might be worth noting (although it has nothing to do with this bug) that the link to join the slack channel expired

dhoman avatar Aug 14 '18 15:08 dhoman

I was using

"firebase-admin": "^6.0.0",
"firebase-functions": "^2.0.4",

The solution I had to do was update the initializeApp call to: admin.initializeApp();

dhoman avatar Aug 15 '18 06:08 dhoman