This is in the context of a firebase app using Stripe with firebase functions.
"dependencies": {
"stripe": "^17.2.0",
"twitter-api-v2": "^1.18.0",
"firebase-admin": "^12.4.0",
"firebase-functions": "^6",
"moment-timezone": "^0.5.45"
},
All was working fine until I updated all packages to the version shown above.
Since then, when I deploy firebase functions (how come this error is not just a runtime error ??), I get error message:
Error: Neither apiKey nor config.authenticator provided
at Stripe._setAuthenticator (C:UserswebkoDocumentsAppsAndWebsitesNoderobotfunctionsnode_modulesstripecjsstripe.core.js:166:23)
at new Stripe (C:UserswebkoDocumentsAppsAndWebsitesNoderobotfunctionsnode_modulesstripecjsstripe.core.js:102:14)
at Stripe (C:UserswebkoDocumentsAppsAndWebsitesNoderobotfunctionsnode_modulesstripecjsstripe.core.js:58:20)
at Object.<anonymous> (C:UserswebkoDocumentsAppsAndWebsitesNoderobotfunctionsindex.js:37:33)
The line in question is this one:
const stripe = require('stripe')(process.env.STRIPE_SECRET);
Since the update, it refuses ‘process.env.STRIPE_SECRET’. But works fine when I hardcode the test key as string.
The secret IS set in the environement, and when I run:
firebase functions:secrets:access STRIPE_SECRET
It correctly shows the secret.
So why passing the secret as ‘process.env.STRIPE_SECRET’ is now a problem ?