这是indexloc提供的服务,不要输入任何密码
Skip to content

extensions emulator (>=v14.2.2) ignores GOOGLE_APPLICATION_CREDENTIALS #8720

@staticshock

Description

@staticshock

[REQUIRED] Environment info

firebase-tools: 14.2.2 through 14.6.0 (latest as of this writing)

Platform: macOS

[REQUIRED] Test case

This used to work for running the stripe extension emulator:

GOOGLE_APPLICATION_CREDENTIALS=$(realpath service-account.json) firebase emulators:start --only=auth,firestore,functions,extensions --project=demo-x

More recently, it's been failing with the following error:

Error: Errors while reading 'extensions' in 'firebase.json'
- Unable to refresh auth: not yet authenticated.

It looks like GOOGLE_APPLICATION_CREDENTIALS is being ignored; only firebase login works.

[REQUIRED] Steps to reproduce

  1. Create a blank project with these files:
echo '{
  "emulators": {
    "functions": { },
    "firestore": { },
    "auth": { }
  },
  "extensions": {
    "stripe": "invertase/firestore-stripe-payments@0.3.11"
  }
}' > firebase.json
mkdir extensions
touch extensions/stripe.env
touch extensions/stripe.secret.local
  1. Add a dummy GCP service account key at service-account.json
  2. Make sure you have firebase-tools v14.2.2 or later
  3. Run GOOGLE_APPLICATION_CREDENTIALS=$(realpath service-account.json) firebase emulators:start --only=auth,firestore,functions,extensions --project=demo-x

[REQUIRED] Expected behavior

Output from v14.1:

⚠  functions: The functions emulator is configured but there is no functions source directory. Have you run firebase init functions?
i  emulators: Starting emulators: auth, functions, firestore, extensions
i  emulators: Detected demo project ID "demo-x", emulated services will use a demo configuration and attempts to access non-emulated services for this project will fail.
⚠  Function 'createPortalLink' is missing a trigger in extension.yaml. Please add one, as triggers defined in code are ignored.
⚠  Function 'handleWebhookEvents' is missing a trigger in extension.yaml. Please add one, as triggers defined in code are ignored.
⚠  functions: The functions emulator is configured but there is no functions source directory. Have you run firebase init functions?
⚠  functions: Application Default Credentials detected. Non-emulated services will access production using these credentials. Be careful!
⚠  firestore: Cloud Firestore Emulator does not support multiple databases yet.
⚠  firestore: Did not find a Cloud Firestore rules file specified in a firebase.json config file.
⚠  firestore: The emulator will default to allowing all reads and writes. Learn more about this option: https://firebase.google.com/docs/emulator-suite/install_and_configure#security_rules_configuration.
i  firestore: Firestore Emulator logging to firestore-debug.log
✔  firestore: Firestore Emulator UI websocket is running on 9150.
i  functions: Watching "/Users/anton/.cache/firebase/extensions/invertase/firestore-stripe-payments@0.3.11/functions" for Cloud Functions...
✔  functions: Loaded functions definitions from source: createCustomer, createCheckoutSession, createPortalLink, handleWebhookEvents, onUserDeleted, onCustomerDataDeleted.
✔  functions[${LOCATION}-ext-stripe-createCustomer]: auth function initialized.
✔  functions[${LOCATION}-ext-stripe-createCheckoutSession]: firestore function initialized.
✔  functions[${LOCATION}-ext-stripe-createPortalLink]: http function initialized (http://127.0.0.1:5001/demo-x/$%7BLOCATION%7D/ext-stripe-createPortalLink).
✔  functions[${LOCATION}-ext-stripe-handleWebhookEvents]: http function initialized (http://127.0.0.1:5001/demo-x/$%7BLOCATION%7D/ext-stripe-handleWebhookEvents).
✔  functions[${LOCATION}-ext-stripe-onUserDeleted]: auth function initialized.
✔  functions[${LOCATION}-ext-stripe-onCustomerDataDeleted]: firestore function initialized.

Notably, this line of the output suggests that GOOGLE_APPLICATION_CREDENTIALS are being picked up correctly:

⚠  functions: Application Default Credentials detected. Non-emulated services will access production using these credentials. Be careful!

[REQUIRED] Actual behavior

Here's output from v14.6, with --debug turned on:

[2025-06-06T19:52:43.204Z] Object "/extensions" in "firebase.json" has unknown property: {"additionalProperty":"stripe"}
⚠  functions: The functions emulator is configured but there is no functions source directory. Have you run firebase init functions? {"metadata":{"emulator":{"name":"functions"},"message":"The functions emulator is configured but there is no functions source directory. Have you run \u001b[1mfirebase init functions\u001b[22m?"}}
[2025-06-06T19:52:43.302Z] openjdk version "23.0.2" 2025-01-21

[2025-06-06T19:52:43.302Z] OpenJDK Runtime Environment Homebrew (build 23.0.2)
OpenJDK 64-Bit Server VM Homebrew (build 23.0.2, mixed mode, sharing)

[2025-06-06T19:52:43.307Z] Parsed Java major version: 23
i  emulators: Starting emulators: auth, functions, firestore, extensions {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: auth, functions, firestore, extensions"}}
i  emulators: Detected demo project ID "demo-x", emulated services will use a demo configuration and attempts to access non-emulated services for this project will fail. {"metadata":{"emulator":{"name":"hub"},"message":"Detected demo project ID \"demo-x\", emulated services will use a demo configuration and attempts to access non-emulated services for this project will fail."}}
[2025-06-06T19:52:43.309Z] Successfully read params from stripe.env
[2025-06-06T19:52:43.309Z] Error: ENOENT: no such file or directory, open '/Users/anton/src/firebase-tmp/extensions/stripe.env.0'
[2025-06-06T19:52:43.309Z] Error: ENOENT: no such file or directory, open '/Users/anton/src/firebase-tmp/extensions/stripe.env.demo-x'
[2025-06-06T19:52:43.309Z] Error: ENOENT: no such file or directory, open '/Users/anton/src/firebase-tmp/extensions/stripe.env.local'
[2025-06-06T19:52:43.310Z] No OAuth tokens found
[2025-06-06T19:52:43.310Z] No OAuth tokens found
[2025-06-06T19:52:43.310Z] Got error reading extensions entry stripe (invertase/firestore-stripe-payments@0.3.11): Unable to refresh auth: not yet authenticated.
[2025-06-06T19:52:43.321Z] Could not find VSCode notification endpoint: FetchError: request to http://localhost:40001/vscode/notify failed, reason: . If you are not running the Firebase Data Connect VSCode extension, this is expected and not an issue.
i  emulators: Shutting down emulators. {"metadata":{"emulator":{"name":"hub"},"message":"Shutting down emulators."}}
[2025-06-06T19:52:43.323Z] Could not find VSCode notification endpoint: FetchError: request to http://localhost:40001/vscode/notify failed, reason: . If you are not running the Firebase Data Connect VSCode extension, this is expected and not an issue.

Error: Errors while reading 'extensions' in 'firebase.json'
- Unable to refresh auth: not yet authenticated.

Having trouble? Try firebase [command] --help

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions