firebase-tools
firebase-tools copied to clipboard
Extension Emulator don’t load secretEnvs silently.
[REQUIRED] Environment info
firebase-tools: v11.13.0
Platform: macOS
[REQUIRED] Test case
- install stripe firebase extension
- run extensions by emulator
- Call
ext-firestore-stripe-payments-createPortalLink
in browser
import { httpsCallable } from 'firebase/functions'
const functionRef = httpsCallable<{ returnUrl: string }, { url: string }>(
functions,
'ext-firestore-stripe-payments-createPortalLink'
)
const { data } = await functionRef({
returnUrl: window.location.href
})
window.location.assign(data.url)
[REQUIRED] Steps to reproduce
The same above.
[REQUIRED] Expected behavior
Emulator load fromSTRIPE_API_KEY
and STRIPE_WEBHOOK_SECRET
from Secret Manager.
STRIPE_API_KEY=projects/${param:PROJECT_NUMBER}/secrets/firestore-stripe-payments-STRIPE_API_KEY/versions/latest
STRIPE_WEBHOOK_SECRET=projects/${param:PROJECT_NUMBER}/secrets/firestore-stripe-payments-STRIPE_WEBHOOK_SECRET-fd8d/versions/latest
[REQUIRED] Actual behavior
Stripe Raise this error, because No API key provided from Firebase Runtime.
> {"severity":"INFO","message":"⚙️ Creating checkout session for doc [nNEzStB2wCK3QbX9FAg7]."}
> {"severity":"INFO","message":"⚙️ Creating customer object for [0uwT7MhNb8pjHjJZ1DMPhW8z9Wct]."}
> {"severity":"ERROR","message":"❗️[Error]: Failed to create customer for [0uwT7MhNb8pjHjJZ1DMPhW8z9Wct]: You did not provide an API key. You need to provide your API key in the Authorization header, using Bearer auth (e.g. 'Authorization: Bearer YOUR_SECRET_KEY'). See https://stripe.com/docs/api#authentication for details, or we can help at https://support.stripe.com/."}
> {"severity":"ERROR","message":"❗️[Error]: Checkout session creation failed for doc [nNEzStB2wCK3QbX9FAg7]: Cannot read properties of null (reading 'stripeId')"}
I noticed, resolveSecretEnvs function silently not load secretEnvs, because called from startRuntime without trigger variable.
(I succeed to load by creating secret.local
file)
I think Emulator show warning at least.
Any updates on this? Same thing happening to me
I'm having the same issue, would appreciate any updates.
Hey all, sorry for the slow reply on this, I initially misunderstood the issue and thought it was lower priority. I spent some time trying to repro this, and I've discovered that it only occurs when running the emulator with the --inspect-functions flag
. I'm going try to submit a fix soon, but as a temporary workaround, you can omit the --inspect-functions
flag
Alright, this appears to be affecting all functions, not just extensions functions, and is a duplicate of #4605. I'm going to close this issue - please track there, as I am actively working on a fix.