firebase / firebase/firebase-tools

[feature request] Extensions Emulator should work when logged out

Open
#5,510 2 comments 2 reactions 1 assignee Claimed by @joehan View on GitHub
emulators: extensions type: feature request
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

### [REQUIRED] Environment info

**firebase-tools: 11.22.0**

**Platform:** macOS

### [REQUIRED] Steps to reproduce
- start a `demo-` project. As per [this](https://firebase.google.com/docs/emulator-suite/connect_auth#:~:text=bucket%2C%20function%2C%20etc.\).-,Demo,-A%20demo%20Firebase) doc

> When working with demo Firebase projects, your apps and code interact with emulators only. If your app attempts to interact with a resource for which an emulator isn't running, that code will fail.

- install some extensions
- try to start emulator

### [REQUIRED] Expected behavior

The emulator pulls the required code and start. (I expect I don't have to be signed in to start my `demo` project emulator.)

### [REQUIRED] Actual behavior

``

```
* Executing firebase emulators:start

i emulators: Starting emulators: auth, functions, firestore, hosting, pubsub, storage, extensions
i emulators: Detected demo project ID "demo-xxx-dev-1", emulated services will use a demo configuration and attempts to access non-emulated services for this project will fail.
i emulators: Shutting down emulators.

Error: Errors while reading 'extensions' in 'firebase.json'
- HTTP Error: 401, Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
- HTTP Error: 401, Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
- HTTP Error: 401, Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.

* The terminal process "/bin/zsh '-c', 'firebase emulators:start'" terminated with exit code: 1.
```

``

```
➜ firebase emulators:start
⚠ emulators: You are not currently authenticated so some features may not work correctly. Please run firebase login to authenticate the CLI.
i emulators: Starting emulators: auth, functions, firestore, hosting, pubsub, storage, extensions
i emulators: Detected demo project ID "demo-xxx-dev-1", emulated services will use a demo configuration and attempts to access non-emulated services for this project will fail.
i emulators: Shutting down emulators.

Error: Errors while reading 'extensions' in 'firebase.json'
- HTTP Error: 401, Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
- HTTP Error: 401, Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
- HTTP Error: 401, Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
```

with `--debug`

```
firebase emulators:start --debug
[2023-02-12T18:58:34.333Z] Object ".extensions" in "firebase.json" has unknown property: {"additionalProperty":"firestore-typesense-search"}
[2023-02-12T18:58:34.335Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
Failed to authenticate, have you run firebase login?
⚠ emulators: You are not currently authenticated so some features may not work correctly. Please run firebase login to authenticate the CLI.
[2023-02-12T18:58:34.377Z] java version "17.0.6" 2023-01-17 LTS

[2023-02-12T18:58:34.377Z] Java(TM) SE Runtime Environment (build 17.0.6+9-LTS-190)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.6+9-LTS-190, mixed mode, sharing)

[2023-02-12T18:58:34.379Z] Parsed Java major version: 17
i emulators: Starting emulators: auth, functions, firestore, hosting, pubsub, storage, extensions {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: auth, functions, firestore, hosting, pubsub, storage, extensions"}}
i emulators: Detected demo project ID "demo-xxx-dev-1", 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-xxx-dev-1\", emulated services will use a demo configuration and attempts to access non-emulated services for this project will fail."}}
[2023-02-12T18:58:34.380Z] Successfully read params from firestore-typesense-search.env
[2023-02-12T18:58:34.381Z] Error: ENOENT: no such file or directory, open '/Users/vajahathahmed/projects/xxx/extensions/firestore-typesense-search.env.default'
[2023-02-12T18:58:34.381Z] Error: ENOENT: no such file or directory, open '/Users/vajahathahmed/projects/xxx/extensions/firestore-typesense-search.env.0'
[2023-02-12T18:58:34.381Z] Error: ENOENT: no such file or directory, open '/Users/vajahathahmed/projects/xxx/extensions/firestore-typesense-search.env.demo-xxx-dev-1'
[2023-02-12T18:58:34.381Z] Error: ENOENT: no such file or directory, open '/Users/vajahathahmed/projects/xxx/extensions/firestore-typesense-search.env.local'
[2023-02-12T18:58:34.382Z] > refreshing access token with scopes: []
[2023-02-12T18:58:34.382Z] >>> [apiv2][query] POST https://www.googleapis.com/oauth2/v3/token [none]
[2023-02-12T18:58:34.382Z] >>> [apiv2][body] POST https://www.googleapis.com/oauth2/v3/token [omitted]
[2023-02-12T18:58:34.559Z] <<< [apiv2][status] POST https://www.googleapis.com/oauth2/v3/token 400
[2023-02-12T18:58:34.559Z] <<< [apiv2][body] POST https://www.googleapis.com/oauth2/v3/token [omitted]
[2023-02-12T18:58:34.560Z] >>> [apiv2][query] GET https://firebaseextensions.googleapis.com/v1beta/publishers/typesense/extensions/firestore-typesense-search/versions filter=&showPrereleases=true&pageSize=100&pageToken=
[2023-02-12T18:58:35.893Z] <<< [apiv2][status] GET https://firebaseextensions.googleapis.com/v1beta/publishers/typesense/extensions/firestore-typesense-search/versions 401
[2023-02-12T18:58:35.894Z] <<< [apiv2][body] GET https://firebaseextensions.googleapis.com/v1beta/publishers/typesense/extensions/firestore-typesense-search/versions {"error":{"code":401,"message":"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","status":"UNAUTHENTICATED","details":[{"@type":"type.googleapis.com/google.rpc.ErrorInfo","reason":"CREDENTIALS_MISSING","domain":"googleapis.com","metadata":{"service":"firebaseextensions.googleapis.com","method":"google.firebase.extensions.v1beta.ExtensionsService.ListExtensionVersions"}}]}}
[2023-02-12T18:58:35.895Z] Got error reading extensions entry firestore-typesense-search,typesense/firestore-typesense-search@0.4.0: FirebaseError: HTTP Error: 401, Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
[2023-02-12T18:58:35.897Z] Successfully read params from typesense-blueprint.env
[2023-02-12T18:58:35.897Z] Error: ENOENT: no such file or directory, open '/Users/vajahathahmed/projects/xxx/extensions/typesense-blueprint.env.default'
[2023-02-12T18:58:35.897Z] Error: ENOENT: no such file or directory, open '/Users/vajahathahmed/projects/xxx/extensions/typesense-blueprint.env.0'
[2023-02-12T18:58:35.898Z] Error: ENOENT: no such file or directory, open '/Users/vajahathahmed/projects/xxx/extensions/typesense-blueprint.env.demo-xxx-dev-1'
[2023-02-12T18:58:35.898Z] Error: ENOENT: no such file or directory, open '/Users/vajahathahmed/projects/xxx/extensions/typesense-blueprint.env.local'
[2023-02-12T18:58:35.899Z] > refreshing access token with scopes: []
[2023-02-12T18:58:35.900Z] >>> [apiv2][query] POST https://www.googleapis.com/oauth2/v3/token [none]
[2023-02-12T18:58:35.900Z] >>> [apiv2][body] POST https://www.googleapis.com/oauth2/v3/token [omitted]
[2023-02-12T18:58:36.231Z] <<< [apiv2][status] POST https://www.googleapis.com/oauth2/v3/token 400
[2023-02-12T18:58:36.231Z] <<< [apiv2][body] POST https://www.googleapis.com/oauth2/v3/token [omitted]
[2023-02-12T18:58:36.231Z] >>> [apiv2][query] GET https://firebaseextensions.googleapis.com/v1beta/publishers/typesense/extensions/firestore-typesense-search/versions filter=&showPrereleases=true&pageSize=100&pageToken=
[2023-02-12T18:58:37.532Z] <<< [apiv2][status] GET https://firebaseextensions.googleapis.com/v1beta/publishers/typesense/extensions/firestore-typesense-search/versions 401
[2023-02-12T18:58:37.533Z] <<< [apiv2][body] GET https://firebaseextensions.googleapis.com/v1beta/publishers/typesense/extensions/firestore-typesense-search/versions {"error":{"code":401,"message":"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","status":"UNAUTHENTICATED","details":[{"@type":"type.googleapis.com/google.rpc.ErrorInfo","reason":"CREDENTIALS_MISSING","domain":"googleapis.com","metadata":{"service":"firebaseextensions.googleapis.com","method":"google.firebase.extensions.v1beta.ExtensionsService.ListExtensionVersions"}}]}}
[2023-02-12T18:58:37.533Z] Got error reading extensions entry typesense-blueprint,typesense/firestore-typesense-search@0.4.0: FirebaseError: HTTP Error: 401, Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
[2023-02-12T18:58:37.535Z] Successfully read params from typesense-brands.env
[2023-02-12T18:58:37.535Z] Error: ENOENT: no such file or directory, open '/Users/vajahathahmed/projects/xxx/extensions/typesense-brands.env.default'
[2023-02-12T18:58:37.535Z] Error: ENOENT: no such file or directory, open '/Users/vajahathahmed/projects/xxx/extensions/typesense-brands.env.0'
[2023-02-12T18:58:37.535Z] Error: ENOENT: no such file or directory, open '/Users/vajahathahmed/projects/xxx/extensions/typesense-brands.env.demo-xxx-dev-1'
[2023-02-12T18:58:37.536Z] Error: ENOENT: no such file or directory, open '/Users/vajahathahmed/projects/xxx/extensions/typesense-brands.env.local'
[2023-02-12T18:58:37.536Z] > refreshing access token with scopes: []
[2023-02-12T18:58:37.537Z] >>> [apiv2][query] POST https://www.googleapis.com/oauth2/v3/token [none]
[2023-02-12T18:58:37.537Z] >>> [apiv2][body] POST https://www.googleapis.com/oauth2/v3/token [omitted]
[2023-02-12T18:58:37.698Z] <<< [apiv2][status] POST https://www.googleapis.com/oauth2/v3/token 400
[2023-02-12T18:58:37.698Z] <<< [apiv2][body] POST https://www.googleapis.com/oauth2/v3/token [omitted]
[2023-02-12T18:58:37.698Z] >>> [apiv2][query] GET https://firebaseextensions.googleapis.com/v1beta/publishers/typesense/extensions/firestore-typesense-search/versions filter=&showPrereleases=true&pageSize=100&pageToken=
[2023-02-12T18:58:38.963Z] <<< [apiv2][status] GET https://firebaseextensions.googleapis.com/v1beta/publishers/typesense/extensions/firestore-typesense-search/versions 401
[2023-02-12T18:58:38.963Z] <<< [apiv2][body] GET https://firebaseextensions.googleapis.com/v1beta/publishers/typesense/extensions/firestore-typesense-search/versions {"error":{"code":401,"message":"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","status":"UNAUTHENTICATED","details":[{"@type":"type.googleapis.com/google.rpc.ErrorInfo","reason":"CREDENTIALS_MISSING","domain":"googleapis.com","metadata":{"service":"firebaseextensions.googleapis.com","method":"google.firebase.extensions.v1beta.ExtensionsService.ListExtensionVersions"}}]}}
[2023-02-12T18:58:38.963Z] Got error reading extensions entry typesense-brands,typesense/firestore-typesense-search@0.4.0: FirebaseError: HTTP Error: 401, Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
i emulators: Shutting down emulators. {"metadata":{"emulator":{"name":"hub"},"message":"Shutting down emulators."}}

Error: Errors while reading 'extensions' in 'firebase.json'
- HTTP Error: 401, Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
- HTTP Error: 401, Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
- HTTP Error: 401, Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.

Having trouble? Try firebase [command] --help
```

When I relogin this issue fixes. But I expect for a demo project, I don't have to sign in and select a project from firebase cloud.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.