Closed Patrick386 closed 10 months ago
I have a similar issue, I need variables to be defined during function deployment to I can configure third party dependencies - also this looks like people are having the same problem in this issue: https://github.com/firebase/firebase-functions/issues/1342
I think this specific use case could be fixed by moving the following code to run inside the function itself:
const stripe = new Stripe(stripeSecretKey.value(), {
apiVersion: "2023-10-16",
typescript: true,
});
The parametrized configuration of secrets is indeed working as intended here - Params cannot be accessed at load time during function deployment. @robert-mccausland's suggestion is correct in that you can initialize the Stripe client at runtime if you place the initialization code inside the function. If you'd like a singleton client object, you can define a global stripe
variable and assign the initialized client object upon the first invocation of stripePaymentIntent
.
I registered the key using the command line or Secret Manager. I'm unable to retrieve the key in my Cloud Function. Please refer to the error message below. How can I fetch the key value?
Functions
https://firebase.google.com/docs/functions/2nd-gen-upgrade#special_case_api_keys