Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emulators shutting down immediately on Github CI if hosting emulator is not disabled since v11.14.2 #5114

Closed
jnizet opened this issue Oct 12, 2022 · 17 comments
Assignees

Comments

@jnizet
Copy link

jnizet commented Oct 12, 2022

[REQUIRED] Environment info

firebase-tools: 11.14.2

Platform: Ubuntu

[REQUIRED] Test case

See this PR: jnizet/decouvertes-nature#399 and the build failing in this github action: https://github.com/jnizet/decouvertes-nature/actions/runs/3232299633/jobs/5292764406

[REQUIRED] Steps to reproduce

The github action starts the emulators with the command

firebase emulators:start --debug --import=emulator-data

[REQUIRED] Expected behavior

The emulators start (that was the case in previous version of firebase tools)

[REQUIRED] Actual behavior

They start, then shut down immediately (see output of the github action)

I've noticed that if I disable the hosting emulator (with --only), then the other emulators start fine.

yarn run v1.22.19
$ concurrently --names "emulators,app,test" --success first --kill-others "firebase emulators:start --debug --import=emulator-data" "yarn build:e2e:ci && yarn serve:e2e:ci" "wait-on --timeout 180000 http://localhost:4201 http://localhost:4000 && yarn playwright test"
[app] $ ng build -c e2e
[emulators] [2022-10-12T05:43:49.515Z] > 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"]
[emulators] Failed to authenticate, have you run firebase login?
[emulators] ⚠  emulators: You are not currently authenticated so some features may not work correctly. Please run firebase login to authenticate the CLI. 
[emulators] [2022-10-12T05:43:49.740Z] <<< [apiv2][status] GET https://firebase-public.firebaseio.com/cli.json 200
[emulators] [2022-10-12T05:43:49.741Z] <<< [apiv2][body] GET https://firebase-public.firebaseio.com/cli.json {"cloudBuildErrorAfter":1594252800000,"cloudBuildWarnAfter":1590019200000,"defaultNode10After":1594252800000,"minVersion":"3.0.5","node8DeploysDisabledAfter":1613390400000,"node8RuntimeDisabledAfter":1615809600000,"node8WarnAfter":1600128000000}
[emulators] [2022-10-12T05:43:49.822Z] openjdk version "11.0.16.1" 2022-08-12
[emulators] 
[emulators] [2022-10-12T05:43:49.823Z] OpenJDK Runtime Environment Temurin-11.0.16.1+1 (build 11.0.16.1+1)
[emulators] OpenJDK 64-Bit Server VM Temurin-11.0.16.1+1 (build 11.0.16.1+1, mixed mode)
[emulators] 
[emulators] [2022-10-12T05:43:49.827Z] Parsed Java major version: 11
[emulators] i  emulators: Starting emulators: auth, functions, firestore, hosting {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: auth, functions, firestore, hosting"}}
[emulators] [2022-10-12T05:43:49.835Z] [logging] Logging Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[emulators] [2022-10-12T05:43:49.836Z] [auth] Authentication Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[emulators] [2022-10-12T05:43:49.837Z] [firestore] Firestore Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[emulators] [2022-10-12T05:43:49.838Z] [firestore.websocket] websocket server for firestore only supports listening on one address (127.0.0.1). Not listening on ::1
[emulators] [2022-10-12T05:43:49.838Z] [hosting] Hosting Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[emulators] [2022-10-12T05:43:49.839Z] assigned listening specs for emulators {"user":{"hub":[{"address":"127.0.0.1","family":"IPv4","port":4400},{"address":"::1","family":"IPv6","port":4400}],"ui":[{"address":"127.0.0.1","family":"IPv4","port":4000},{"address":"::1","family":"IPv6","port":4000}],"logging":[{"address":"127.0.0.1","family":"IPv4","port":4500}],"auth":[{"address":"127.0.0.1","family":"IPv4","port":9099}],"firestore":[{"address":"127.0.0.1","family":"IPv4","port":7070}],"firestore.websocket":[{"address":"127.0.0.1","family":"IPv4","port":9150}],"hosting":[{"address":"127.0.0.1","family":"IPv4","port":12000}]},"metadata":{"message":"assigned listening specs for emulators"}}
[emulators] [2022-10-12T05:43:49.844Z] [hub] writing locator at /tmp/hub-decouvertes-nature.json
[emulators] [2022-10-12T05:43:49.848Z] [functions] Functions Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[emulators] [2022-10-12T05:43:49.855Z] [eventarc] Eventarc Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[emulators] [2022-10-12T05:43:49.855Z] late-assigned ports for functions and eventarc emulators {"user":{"hub":[{"address":"127.0.0.1","family":"IPv4","port":4400},{"address":"::1","family":"IPv6","port":4400}],"ui":[{"address":"127.0.0.1","family":"IPv4","port":4000},{"address":"::1","family":"IPv6","port":4000}],"logging":[{"address":"127.0.0.1","family":"IPv4","port":4500}],"auth":[{"address":"127.0.0.1","family":"IPv4","port":9099}],"firestore":[{"address":"127.0.0.1","family":"IPv4","port":7070}],"firestore.websocket":[{"address":"127.0.0.1","family":"IPv4","port":9150}],"hosting":[{"address":"127.0.0.1","family":"IPv4","port":12000}],"functions":[{"address":"127.0.0.1","family":"IPv4","port":5001}],"eventarc":[{"address":"127.0.0.1","family":"IPv4","port":9299}]},"metadata":{"message":"late-assigned ports for functions and eventarc emulators"}}
[emulators] ⚠  functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: database, pubsub, storage {"metadata":{"emulator":{"name":"functions"},"message":"The following emulators are not running, calls to these services from the Functions emulator will affect production: \u001b[1mdatabase, pubsub, storage\u001b[22m"}}
[emulators] ✔  functions: Using node@14 from host. {"metadata":{"emulator":{"name":"functions"},"message":"Using node@14 from host."}}
[emulators] ⚠  functions: You are not signed in to the Firebase CLI. If you have authorized this machine using gcloud application-default credentials those may be discovered and used to access production services. {"metadata":{"emulator":{"name":"functions"},"message":"You are not signed in to the Firebase CLI. If you have authorized this machine using gcloud application-default credentials those may be discovered and used to access production services."}}
[emulators] [2022-10-12T05:43:49.866Z] > refreshing access token with scopes: []
[emulators] [2022-10-12T05:43:49.867Z] >>> [apiv2][query] POST https://www.googleapis.com/oauth2/v3/token [none]
[emulators] [2022-10-12T05:43:49.867Z] >>> [apiv2][body] POST https://www.googleapis.com/oauth2/v3/token [omitted]
[emulators] [2022-10-12T05:43:49.918Z] <<< [apiv2][status] POST https://www.googleapis.com/oauth2/v3/token 400
[emulators] [2022-10-12T05:43:49.919Z] <<< [apiv2][body] POST https://www.googleapis.com/oauth2/v3/token [omitted]
[emulators] [2022-10-12T05:43:49.920Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/decouvertes-nature/adminSdkConfig [none]
[emulators] [2022-10-12T05:43:50.032Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/decouvertes-nature/adminSdkConfig 401
[emulators] [2022-10-12T05:43:50.033Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/decouvertes-nature/adminSdkConfig {"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":{"method":"google.firebase.service.v1beta1.FirebaseProjectService.GetAdminSdkConfig","service":"firebase.googleapis.com"}}]}}
[emulators] [2022-10-12T05:43:50.035Z] Failed to get Admin SDK config for decouvertes-nature, falling back to cache Failed to get Admin SDK for Firebase project decouvertes-nature. Please make sure the project exists and your account has permission to access it. {"name":"FirebaseError","children":[],"exit":2,"message":"Failed to get Admin SDK for Firebase project decouvertes-nature. Please make sure the project exists and your account has permission to access it.","original":{"name":"FirebaseError","children":[],"context":{"body":{"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":{"method":"google.firebase.service.v1beta1.FirebaseProjectService.GetAdminSdkConfig","service":"firebase.googleapis.com"}}]}},"response":{"statusCode":401}},"exit":1,"message":"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.","status":401},"status":500}
[emulators] ⚠  functions: Unable to fetch project Admin SDK configuration, Admin SDK behavior in Cloud Functions emulator may be incorrect. {"metadata":{"emulator":{"name":"functions"},"message":"Unable to fetch project Admin SDK configuration, Admin SDK behavior in Cloud Functions emulator may be incorrect."}}
[emulators] i  firestore: Importing data from /home/runner/work/decouvertes-nature/decouvertes-nature/emulator-data/firestore_export/firestore_export.overall_export_metadata {"metadata":{"emulator":{"name":"firestore"},"message":"Importing data from /home/runner/work/decouvertes-nature/decouvertes-nature/emulator-data/firestore_export/firestore_export.overall_export_metadata"}}
[emulators] ⚠  It appears you are running in a CI environment. You can avoid downloading the Firestore Emulator repeatedly by caching the /home/runner/.cache/firebase/emulators directory. 
[emulators] i  firestore: downloading cloud-firestore-emulator-v1.15.1.jar... {"metadata":{"emulator":{"name":"firestore"},"message":"downloading cloud-firestore-emulator-v1.15.1.jar..."}}
[emulators] [2022-10-12T05:43:50.053Z] >>> [apiv2][query] GET https://storage.googleapis.com/firebase-preview-drop/emulator/cloud-firestore-emulator-v1.15.1.jar 
[emulators] [2022-10-12T05:43:50.134Z] <<< [apiv2][status] GET https://storage.googleapis.com/firebase-preview-drop/emulator/cloud-firestore-emulator-v1.15.1.jar 200
[emulators] [2022-10-12T05:43:50.134Z] <<< [apiv2][body] GET https://storage.googleapis.com/firebase-preview-drop/emulator/cloud-firestore-emulator-v1.15.1.jar [stream]
[emulators] 
[app] - Generating browser application bundles (phase: setup)...
[emulators] [2022-10-12T05:43:50.921Z] Ignoring unsupported arg: auto_download {"metadata":{"emulator":{"name":"firestore"},"message":"Ignoring unsupported arg: auto_download"}}
[emulators] [2022-10-12T05:43:50.921Z] Ignoring unsupported arg: single_project_mode_error {"metadata":{"emulator":{"name":"firestore"},"message":"Ignoring unsupported arg: single_project_mode_error"}}
[emulators] [2022-10-12T05:43:50.922Z] Starting Firestore Emulator with command {"binary":"java","args":["-Dgoogle.cloud_firestore.debug_log_level=FINE","-Duser.language=en","-jar","/home/runner/.cache/firebase/emulators/cloud-firestore-emulator-v1.15.1.jar","--host","127.0.0.1","--port",7070,"--websocket_port",9150,"--project_id","decouvertes-nature","--seed_from_export","/home/runner/work/decouvertes-nature/decouvertes-nature/emulator-data/firestore_export/firestore_export.overall_export_metadata","--rules","/home/runner/work/decouvertes-nature/decouvertes-nature/firestore.rules","--single_project_mode",true,"--functions_emulator","127.0.0.1:5001"],"optionalArgs":["port","webchannel_port","host","rules","websocket_port","functions_emulator","seed_from_export","project_id","single_project_mode"],"joinArgs":false} {"metadata":{"emulator":{"name":"firestore"},"message":"Starting Firestore Emulator with command {\"binary\":\"java\",\"args\":[\"-Dgoogle.cloud_firestore.debug_log_level=FINE\",\"-Duser.language=en\",\"-jar\",\"/home/runner/.cache/firebase/emulators/cloud-firestore-emulator-v1.15.1.jar\",\"--host\",\"127.0.0.1\",\"--port\",7070,\"--websocket_port\",9150,\"--project_id\",\"decouvertes-nature\",\"--seed_from_export\",\"/home/runner/work/decouvertes-nature/decouvertes-nature/emulator-data/firestore_export/firestore_export.overall_export_metadata\",\"--rules\",\"/home/runner/work/decouvertes-nature/decouvertes-nature/firestore.rules\",\"--single_project_mode\",true,\"--functions_emulator\",\"127.0.0.1:5001\"],\"optionalArgs\":[\"port\",\"webchannel_port\",\"host\",\"rules\",\"websocket_port\",\"functions_emulator\",\"seed_from_export\",\"project_id\",\"single_project_mode\"],\"joinArgs\":false}"}}
[emulators] i  firestore: Firestore Emulator logging to firestore-debug.log {"metadata":{"emulator":{"name":"firestore"},"message":"Firestore Emulator logging to \u001b[1mfirestore-debug.log\u001b[22m"}}
[emulators] [2022-10-12T05:43:52.935Z] Oct 12, 2022 5:43:52 AM com.google.cloud.datastore.emulator.firestore.websocket.WebSocketServer start
[emulators] INFO: Started WebSocket server on ws://127.0.0.1:9150
[emulators]  {"metadata":{"emulator":{"name":"firestore"},"message":"Oct 12, 2022 5:43:52 AM com.google.cloud.datastore.emulator.firestore.websocket.WebSocketServer start\nINFO: Started WebSocket server on ws://127.0.0.1:9150\n"}}
[emulators] [2022-10-12T05:43:52.967Z] API endpoint: http://127.0.0.1:7070/
[emulators] If you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:
[emulators] 
[emulators]    export FIRESTORE_EMULATOR_HOST=127.0.0.1:7070
[emulators] 
[emulators] Dev App Server is now running.
[emulators] 
[emulators]  {"metadata":{"emulator":{"name":"firestore"},"message":"API endpoint: [http://127.0.0.1:7070\nIf](http://127.0.0.1:7070/nIf) you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:\n\n   export FIRESTORE_EMULATOR_HOST=127.0.0.1:7070\n\nDev App Server is now running.\n\n"}}
[emulators] ✔  firestore: Firestore Emulator UI websocket is running on 9150. {"metadata":{"emulator":{"name":"firestore"},"message":"Firestore Emulator UI websocket is running on 9150."}}
[emulators] i  auth: Importing config from /home/runner/work/decouvertes-nature/decouvertes-nature/emulator-data/auth_export/config.json {"metadata":{"emulator":{"name":"auth"},"message":"Importing config from /home/runner/work/decouvertes-nature/decouvertes-nature/emulator-data/auth_export/config.json"}}
[emulators] i  auth: Importing accounts from /home/runner/work/decouvertes-nature/decouvertes-nature/emulator-data/auth_export/accounts.json {"metadata":{"emulator":{"name":"auth"},"message":"Importing accounts from /home/runner/work/decouvertes-nature/decouvertes-nature/emulator-data/auth_export/accounts.json"}}
[emulators] [2022-10-12T05:44:04.511Z] > refreshing access token with scopes: []
[emulators] [2022-10-12T05:44:04.512Z] >>> [apiv2][query] POST https://www.googleapis.com/oauth2/v3/token [none]
[emulators] [2022-10-12T05:44:04.512Z] >>> [apiv2][body] POST https://www.googleapis.com/oauth2/v3/token [omitted]
[emulators] [2022-10-12T05:44:04.555Z] <<< [apiv2][status] POST https://www.googleapis.com/oauth2/v3/token 400
[emulators] [2022-10-12T05:44:04.555Z] <<< [apiv2][body] POST https://www.googleapis.com/oauth2/v3/token [omitted]
[emulators] [2022-10-12T05:44:04.556Z] >>> [apiv2][query] GET https://firebasehosting.googleapis.com/v1beta1/projects/decouvertes-nature/sites 
[emulators] [2022-10-12T05:44:04.751Z] <<< [apiv2][status] GET https://firebasehosting.googleapis.com/v1beta1/projects/decouvertes-nature/sites 401
[emulators] [2022-10-12T05:44:04.751Z] <<< [apiv2][body] GET https://firebasehosting.googleapis.com/v1beta1/projects/decouvertes-nature/sites {"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":"firebasehosting.googleapis.com","method":"google.firebase.hosting.v1beta1.MetadataService.ListSites"}}]}}
[emulators] [2022-10-12T05:44:04.752Z] Failed to list hosting sites
[emulators] 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.
[emulators] [2022-10-12T05:44:04.753Z] > refreshing access token with scopes: []
[emulators] [2022-10-12T05:44:04.754Z] >>> [apiv2][query] POST https://www.googleapis.com/oauth2/v3/token [none]
[emulators] [2022-10-12T05:44:04.754Z] >>> [apiv2][body] POST https://www.googleapis.com/oauth2/v3/token [omitted]
[emulators] [2022-10-12T05:44:04.797Z] <<< [apiv2][status] POST https://www.googleapis.com/oauth2/v3/token 400
[emulators] [2022-10-12T05:44:04.798Z] <<< [apiv2][body] POST https://www.googleapis.com/oauth2/v3/token [omitted]
[emulators] [2022-10-12T05:44:04.798Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/decouvertes-nature/webApps/-/config [none]
[emulators] [2022-10-12T05:44:04.900Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/decouvertes-nature/webApps/-/config 401
[emulators] [2022-10-12T05:44:04.900Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/decouvertes-nature/webApps/-/config {"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":"firebase.googleapis.com","method":"google.firebase.service.v1beta1.WebAppService.GetWebAppConfig"}}]}}
[emulators] [2022-10-12T05:44:04.900Z] fetchWebSetup error: 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.
[emulators] ⚠  hosting: Could not fetch web app configuration and there is no cached configuration on this machine. Check your internet connection and make sure you are authenticated. To continue, you must call firebase.initializeApp({...}) in your code before using Firebase. 
[emulators] [2022-10-12T05:44:04.901Z] > refreshing access token with scopes: []
[emulators] [2022-10-12T05:44:04.901Z] >>> [apiv2][query] POST https://www.googleapis.com/oauth2/v3/token [none]
[emulators] [2022-10-12T05:44:04.901Z] >>> [apiv2][body] POST https://www.googleapis.com/oauth2/v3/token [omitted]
[emulators] [2022-10-12T05:44:04.957Z] <<< [apiv2][status] POST https://www.googleapis.com/oauth2/v3/token 400
[emulators] [2022-10-12T05:44:04.957Z] <<< [apiv2][body] POST https://www.googleapis.com/oauth2/v3/token [omitted]
[emulators] [2022-10-12T05:44:04.968Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/decouvertes-nature [none]
[emulators] [2022-10-12T05:44:05.077Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/decouvertes-nature 401
[emulators] [2022-10-12T05:44:05.077Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/decouvertes-nature {"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":{"method":"google.firebase.service.v1beta1.FirebaseProjectService.GetFirebaseProject","service":"firebase.googleapis.com"}}]}}
[emulators] [2022-10-12T05:44:05.077Z] 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.
[emulators] i  emulators: Shutting down emulators. {"metadata":{"emulator":{"name":"hub"},"message":"Shutting down emulators."}}
[emulators] i  functions: Stopping Functions Emulator {"metadata":{"emulator":{"name":"functions"},"message":"Stopping Functions Emulator"}}
[emulators] i  hosting: Stopping Hosting Emulator {"metadata":{"emulator":{"name":"hosting"},"message":"Stopping Hosting Emulator"}}
[emulators] i  firestore: Stopping Firestore Emulator {"metadata":{"emulator":{"name":"firestore"},"message":"Stopping Firestore Emulator"}}
[emulators] [2022-10-12T05:44:05.137Z] *** shutting down gRPC server since JVM is shutting down {"metadata":{"emulator":{"name":"firestore"},"message":"*** shutting down gRPC server since JVM is shutting down"}}
[emulators] [2022-10-12T05:44:05.138Z] 
[emulators]  {"metadata":{"emulator":{"name":"firestore"},"message":"\n"}}
[emulators] [2022-10-12T05:44:05.194Z] 221012 05:44:05.147:I 1 [main] [com.google.cloud.datastore.emulator.firestore.websocket.WebSocketServer.stop:80] Stopping WebSocket server...
[emulators] *** server shut down
[emulators]  {"metadata":{"emulator":{"name":"firestore"},"message":"221012 05:44:05.147:I 1 [main] [com.google.cloud.datastore.emulator.firestore.websocket.WebSocketServer.stop:80] Stopping WebSocket server...\n*** server shut down\n"}}
[emulators] i  auth: Stopping Authentication Emulator {"metadata":{"emulator":{"name":"auth"},"message":"Stopping Authentication Emulator"}}
[emulators] i  eventarc: Stopping Eventarc Emulator {"metadata":{"emulator":{"name":"eventarc"},"message":"Stopping Eventarc Emulator"}}
[emulators] i  hub: Stopping emulator hub {"metadata":{"emulator":{"name":"hub"},"message":"Stopping emulator hub"}}
[emulators] [2022-10-12T05:44:05.542Z] SyntaxError: Unexpected token u in JSON at position 0
[emulators]     at JSON.parse (<anonymous>)
[emulators]     at Object.start (/home/runner/work/decouvertes-nature/decouvertes-nature/node_modules/firebase-tools/lib/serve/hosting.js:110:33)
[emulators]     at runMicrotasks (<anonymous>)
[emulators]     at processTicksAndRejections (internal/process/task_queues.js:95:5)
[emulators]     at async Function.start (/home/runner/work/decouvertes-nature/decouvertes-nature/node_modules/firebase-tools/lib/emulator/registry.js:18:9)
[emulators]     at async Object.startAll (/home/runner/work/decouvertes-nature/decouvertes-nature/node_modules/firebase-tools/lib/emulator/controller.js:519:9)
[emulators]     at async /home/runner/work/decouvertes-nature/decouvertes-nature/node_modules/firebase-tools/lib/commands/emulators-start.js:32:43
[emulators] 
[emulators] Error: An unexpected error has occurred.
[emulators] firebase emulators:start --debug --import=emulator-data exited with code 2
@jnizet jnizet added the bug label Oct 12, 2022
@f1ames
Copy link

f1ames commented Oct 12, 2022

I can confirm this issue. We are running firebase emulators inside docker container and it started failing with 11.14.2.

The container uses it like:

FROM node:16-slim
...
RUN npm install -g firebase-tools && firebase --version

and then ENTRYPOINT starts the application and firebase emulators.

Debug logs shows:

cat firebase-debug.log
[debug] [2022-10-12T10:58:20.105Z] ----------------------------------------------------------------------
[debug] [2022-10-12T10:58:20.107Z] Command:       /usr/local/bin/node /usr/local/bin/firebase emulators:start
[debug] [2022-10-12T10:58:20.107Z] CLI Version:   11.14.2
[debug] [2022-10-12T10:58:20.107Z] Platform:      linux
[debug] [2022-10-12T10:58:20.107Z] Node Version:  v16.17.0
[debug] [2022-10-12T10:58:20.108Z] Time:          Wed Oct 12 2022 10:58:20 GMT+0000 (Coordinated Universal Time)
[debug] [2022-10-12T10:58:20.108Z] ----------------------------------------------------------------------
[debug]
[debug] [2022-10-12T10:58:20.110Z] >>> [apiv2][query] GET https://firebase-public.firebaseio.com/cli.json [none]
[debug] [2022-10-12T10:58:20.199Z] > 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"]
[debug] Failed to authenticate, have you run firebase login?
[warn] ⚠  emulators: You are not currently authenticated so some features may not work correctly. Please run firebase login to authenticate the CLI.
[info] i  emulators: Starting emulators: auth, functions {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: auth, functions"}}
[info] i  emulators: Shutting down emulators. {"metadata":{"emulator":{"name":"hub"},"message":"Shutting down emulators."}}
[debug] [2022-10-12T10:58:20.297Z] Error: listen EADDRNOTAVAIL: address not available ::1:4400
    at Server.setupListenHandle [as _listen2] (node:net:1415:21)
    at listenInCluster (node:net:1480:12)
    at doListen (node:net:1629:7)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)
[error]
[error] Error: An unexpected error has occurred.

@elietech
Copy link

I too am experiencing this running in a VS Code Dev container.

$ firebase emulators:start

This immediately fails, and leaves the following in firebase-debug.log

[debug] [2022-10-12T13:33:18.148Z] ----------------------------------------------------------------------
[debug] [2022-10-12T13:33:18.150Z] Command:       /usr/local/bin/node /usr/local/share/npm-global/bin/firebase emulators:start --inspect-functions
[debug] [2022-10-12T13:33:18.150Z] CLI Version:   11.14.2
[debug] [2022-10-12T13:33:18.150Z] Platform:      linux
[debug] [2022-10-12T13:33:18.150Z] Node Version:  v16.17.1
[debug] [2022-10-12T13:33:18.151Z] Time:          Wed Oct 12 2022 13:33:18 GMT+0000 (Coordinated Universal Time)
[debug] [2022-10-12T13:33:18.151Z] ----------------------------------------------------------------------
[debug] 
[debug] [2022-10-12T13:33:18.241Z] > 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"]
[debug] [2022-10-12T13:33:18.242Z] > authorizing via signed-in user (...)
[debug] [2022-10-12T13:33:18.299Z] openjdk version "11.0.16" 2022-07-19

[debug] [2022-10-12T13:33:18.300Z] OpenJDK Runtime Environment (build 11.0.16+8-post-Debian-1deb11u1)
OpenJDK 64-Bit Server VM (build 11.0.16+8-post-Debian-1deb11u1, mixed mode, sharing)

[debug] [2022-10-12T13:33:18.304Z] Parsed Java major version: 11
[info] i  emulators: Starting emulators: auth, functions, firestore, database, hosting, pubsub, storage {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: auth, functions, firestore, database, hosting, pubsub, storage"}}
[info] i  emulators: Shutting down emulators. {"metadata":{"emulator":{"name":"hub"},"message":"Shutting down emulators."}}
[debug] [2022-10-12T13:33:18.461Z] Error: listen EADDRNOTAVAIL: address not available ::1:4400
    at Server.setupListenHandle [as _listen2] (node:net:1415:21)
    at listenInCluster (node:net:1480:12)
    at doListen (node:net:1629:7)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)
[error] 
[error] Error: An unexpected error has occurred.

@bkendall
Copy link
Contributor

I believe the EADDRNOTAVAIL errors should be addressed by #5112.

jnizet@ As to the original error, I'm not positive that that same bug will fix the issue, but I'm a little suspicious that the CLI doesn't believe it's authenticated. I see HTTP Error: 401, Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. and Failed to authenticate, have you run firebase login? in the logs. Did it work before without authentication? Aaaand I'll answer my own question, yes it did: https://github.com/jnizet/decouvertes-nature/actions/runs/3221756210/jobs/5270073984

@yuchenshi I see the following regarding ports and bindings. Is this suspicious?

[emulators] [2022-10-12T05:43:49.835Z] [logging] Logging Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[emulators] [2022-10-12T05:43:49.836Z] [auth] Authentication Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[emulators] [2022-10-12T05:43:49.837Z] [firestore] Firestore Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[emulators] [2022-10-12T05:43:49.838Z] [firestore.websocket] websocket server for firestore only supports listening on one address (127.0.0.1). Not listening on ::1
[emulators] [2022-10-12T05:43:49.838Z] [hosting] Hosting Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[emulators] [2022-10-12T05:43:49.839Z] assigned listening specs for emulators {"user":{"hub":[{"address":"127.0.0.1","family":"IPv4","port":4400},{"address":"::1","family":"IPv6","port":4400}],"ui":[{"address":"127.0.0.1","family":"IPv4","port":4000},{"address":"::1","family":"IPv6","port":4000}],"logging":[{"address":"127.0.0.1","family":"IPv4","port":4500}],"auth":[{"address":"127.0.0.1","family":"IPv4","port":9099}],"firestore":[{"address":"127.0.0.1","family":"IPv4","port":7070}],"firestore.websocket":[{"address":"127.0.0.1","family":"IPv4","port":9150}],"hosting":[{"address":"127.0.0.1","family":"IPv4","port":12000}]},"metadata":{"message":"assigned listening specs for emulators"}}
[emulators] [2022-10-12T05:43:49.844Z] [hub] writing locator at /tmp/hub-decouvertes-nature.json
[emulators] [2022-10-12T05:43:49.848Z] [functions] Functions Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[emulators] [2022-10-12T05:43:49.855Z] [eventarc] Eventarc Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[emulators] [2022-10-12T05:43:49.855Z] late-assigned ports for functions and eventarc emulators {"user":{"hub":[{"address":"127.0.0.1","family":"IPv4","port":4400},{"address":"::1","family":"IPv6","port":4400}],"ui":[{"address":"127.0.0.1","family":"IPv4","port":4000},{"address":"::1","family":"IPv6","port":4000}],"logging":[{"address":"127.0.0.1","family":"IPv4","port":4500}],"auth":[{"address":"127.0.0.1","family":"IPv4","port":9099}],"firestore":[{"address":"127.0.0.1","family":"IPv4","port":7070}],"firestore.websocket":[{"address":"127.0.0.1","family":"IPv4","port":9150}],"hosting":[{"address":"127.0.0.1","family":"IPv4","port":12000}],"functions":[{"address":"127.0.0.1","family":"IPv4","port":5001}],"eventarc":[{"address":"127.0.0.1","family":"IPv4","port":9299}]},"metadata":{"message":"late-assigned ports for functions and eventarc emulators"}}

@bkendall
Copy link
Contributor

bkendall commented Oct 12, 2022

Woo! I can replicate this. In short, a hosting setup where the webapp config (in ~/.config/configstore/firebase-tools.json) is not cached causes this exact issue. I know how to fix it quickly, but the reasons why this logic was added mean that other things may not work right.

The "easy" workaround for now is going to be to authenticate the CLI in your CI. The "fast" fix causes other issues, so I'm going to have to track this down a bit more.

@akauppi
Copy link

akauppi commented Oct 12, 2022

Same error here too, @bkendall

I'm running firebase-tools within an Alpine-based Docker image. I never authenticate, so these comments make me a bit... uneasy:

jnizet@ As to the original error, I'm not positive that that same bug will fix the issue, but I'm a little suspicious that the CLI doesn't believe it's authenticated. I see HTTP Error: 401, Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. and Failed to authenticate, have you run firebase login? in the logs. Did it work before without authentication?

Why would an emulator need to be authenticated?

The "easy" workaround for now is going to be to authenticate the CLI in your CI.

Ready to test fixes any time.


p.s.
Have you tested the 11.14.2 on OS images that don't have IPv6 on them? If the code tries to reach ::1:4400 but there's no support for IPv6 whatsoever (that could be the case for my image) then maybe that's the cause.

Is there any way for me to ask firebase-tools not to use IPv6 detection?

@dereekb
Copy link

dereekb commented Oct 12, 2022

Running into this too on CircleCI:

https://app.circleci.com/pipelines/github/dereekb/dbx-components/2029/workflows/0f2f9cd3-34dc-4314-85d0-1108b00ac6c0/jobs/5844/parallel-runs/0/steps/0-114

Here's the firebase-debug.log output:

circleci@09bae7a4d874:~/setup-test/myproject$ cat firebase-debug.log 
[debug] [2022-10-12T22:04:42.416Z] ----------------------------------------------------------------------
[debug] [2022-10-12T22:04:42.418Z] Command:       /home/circleci/.nvm/versions/node/v16.15.1/bin/node /home/circleci/setup-test/myproject/node_modules/.bin/firebase --project=default emulators:exec --only auth,firestore,storage npx nx run-tests myproject-api --skip-nx-cache
[debug] [2022-10-12T22:04:42.418Z] CLI Version:   11.14.2
[debug] [2022-10-12T22:04:42.418Z] Platform:      linux
[debug] [2022-10-12T22:04:42.419Z] Node Version:  v16.15.1
[debug] [2022-10-12T22:04:42.419Z] Time:          Wed Oct 12 2022 22:04:42 GMT+0000 (Coordinated Universal Time)
[debug] [2022-10-12T22:04:42.419Z] ----------------------------------------------------------------------
[debug] 
[debug] [2022-10-12T22:04:42.471Z] Object ".functions" in "firebase.json" has unknown property: {"additionalProperty":"engines"}
[debug] [2022-10-12T22:04:42.472Z] Field ".functions" in "firebase.json" is possibly invalid: should be array
[debug] [2022-10-12T22:04:42.472Z] Field ".functions" in "firebase.json" is possibly invalid: should match some schema in anyOf
[debug] [2022-10-12T22:04:42.475Z] > 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"]
[debug] [2022-10-12T22:04:42.476Z] > authorizing via FIREBASE_TOKEN environment variable
[warn] ⚠  Authenticating with `FIREBASE_TOKEN` is deprecated and will be removed in a future major version of `firebase-tools`. Instead, use a service account key with `GOOGLE_APPLICATION_CREDENTIALS`: https://cloud.google.com/docs/authentication/getting-started 
[debug] [2022-10-12T22:04:42.532Z] openjdk version "11.0.16" 2022-07-19

[debug] [2022-10-12T22:04:42.532Z] OpenJDK Runtime Environment (build 11.0.16+8-post-Ubuntu-0ubuntu120.04)
OpenJDK 64-Bit Server VM (build 11.0.16+8-post-Ubuntu-0ubuntu120.04, mixed mode, sharing)

[debug] [2022-10-12T22:04:42.536Z] Parsed Java major version: 11
[info] i  emulators: Starting emulators: auth, firestore, storage {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: auth, firestore, storage"}}
[info] i  emulators: Shutting down emulators. {"metadata":{"emulator":{"name":"hub"},"message":"Shutting down emulators."}}
[debug] [2022-10-12T22:04:42.543Z] Error: listen EADDRNOTAVAIL: address not available ::1:4400
    at Server.setupListenHandle [as _listen2] (node:net:1355:21)
    at listenInCluster (node:net:1420:12)
    at doListen (node:net:1559:7)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)
[error] 
[error] Error: An unexpected error has occurred.

dereekb added a commit to dereekb/dbx-components that referenced this issue Oct 12, 2022
@bkendall
Copy link
Contributor

bkendall commented Oct 13, 2022

@akauppi - there's definitely a valid case for what I'll more broadly describe as "offline emulator support". As more and more emulators have been supported, it's been 'easier' to test locally without needing to reach out to the internet. In years past, we've considered "being online" as a basic requirement for running (at that time, the only really available things:) the hosting and functions emulators - we required some configuration that was only stored server-side to be able to properly "emulate" Hosting (it's actually what the error here stems from), so we would fetch (and eventually locally cache) this data.

As the emulators have evolved, more thought has started to go into making "offline mode" a... I guess the best way to describe it is a "supported feature". The fact that the emulators happen to work pretty well without authentication is surprising to me because (a) I don't do that (I'm usually deploying, which requires auth, but I'm always pleasantly surprised when I hear about new uses), and (b) it's not something we've explicitly worked to enable. There's definitely some work ahead of us to make sure that offline mode would work successfully for all cases the emulators are used for, but it's not something we explicitly support today.

(I feel like I should say "by all means, if it keeps working, keep on doing it", but the truth of the matter is that because we've never specifically said "the emulators will work without an internet connection", I would just add "with caution").

All that said: there's a movement starting to make the emulator work without an internet connection. There's still some cases (like the before-mentioned configuration) that we may have to fetch once (or, in a CI environment, might have to be provided if required) but there's a lot of cases where it may not be necessary at all. I think it's totally fair to let us know if we make changes that break cases where the CLI isn't authenticated or we explicitly require an internet connection.

Okay, long-winded response is long-winded. Sorry about that. But when it makes you "uneasy", I like to try and realize why and help provide context from our side. In my mind now, I can see the very easy step from "emulator" to "not needing to authenticate", and that helps me a lot in getting teams to do the work to make that more of a (official) reality (and break our biases about "everyone logs in or provides a service account").

@bkendall
Copy link
Contributor

I do believe this should be fixed by #5112, #5115, and #5119. It turns out that dealing with addresses (and managing multiple things talking to each other via these addresses) continues to be hard! Likely a patch going out tomorrow morning with these fixes.

@jnizet
Copy link
Author

jnizet commented Oct 13, 2022

@bkendall Just my two cents here: I also use the emulators expecting that they replace the actual production firebase environment, hence the lack of authentication. I understand where you came from, but IMHO, the whole point of using emulators is to be able to fully test an application during development without having to deploy anything, nor impact the production environment and data in any way.

@akauppi
Copy link

akauppi commented Oct 13, 2022

@ariel-dao
Copy link

Same issue for me, getting very tedious to remove the hosting lines from the config just to run the emulators.

@bkendall
Copy link
Contributor

@jnizet 👍 'tis the goal! I think the "does it require authentication to the CLI" has simply been an overlooked question. But not any more! 🙂

Patch release is coming out Soon.

@dereekb
Copy link

dereekb commented Oct 13, 2022

Issue looks like the issue is resolved for my pipeline when using 11.4.3 and everything passes successfully.

https://app.circleci.com/pipelines/github/dereekb/dbx-components/2042/workflows/0c9487a7-cd7e-4e9b-8553-125ed262f1c6/jobs/5882/parallel-runs/0/steps/0-113

I see the new warnings:

⚠  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, firestore, storage
⚠  hub: Error when trying to check port 4400 on ::1: Error: listen EADDRNOTAVAIL: address not available ::1:4400
⚠  hub: Port 4400 is available on 127.0.0.1 but not ::1. This may cause issues with some clients.
⚠  hub: If you encounter connectivity issues, consider switching to a different port or explicitly specifying "host": "<ip address>" instead of hostname in firebase.json
⚠  logging: Error when trying to check port 4500 on ::1: Error: listen EADDRNOTAVAIL: address not available ::1:4500
⚠  logging: Port 4500 is available on 127.0.0.1 but not ::1. This may cause issues with some clients.
⚠  logging: If you encounter connectivity issues, consider switching to a different port or explicitly specifying "host": "<ip address>" instead of hostname in firebase.json
⚠  It appears you are running in a CI environment. You can avoid downloading the Firestore Emulator repeatedly by caching the /home/circleci/.cache/firebase/emulators directory.

@yuchenshi
Copy link
Member

Glad to hear that! Closing.

@jnizet
Copy link
Author

jnizet commented Oct 14, 2022

Fixed here too. Thanks for the fix.

@ariel-dao
Copy link

Issue not fixed for me after update... is this just me?

[debug] [2022-10-18T08:43:29.319Z] CLI Version: 11.14.4 [debug] [2022-10-18T08:43:29.320Z] Platform: darwin [debug] [2022-10-18T08:43:29.320Z] Node Version: v16.13.2 [debug] [2022-10-18T08:43:29.321Z] Time: Tue Oct 18 2022 10:43:29 GMT+0200 (Central European Summer Time) [debug] [2022-10-18T08:43:29.321Z] Env Overrides: FIRESTORE_EMULATOR_HOST [debug] [2022-10-18T08:43:29.321Z] ---------------------------------------------------------------------- [debug] [debug] [2022-10-18T08:43:29.371Z] Field ".hosting" in "firebase.json" is possibly invalid: should be object [debug] [2022-10-18T08:43:29.371Z] Field ".hosting" in "firebase.json" is possibly invalid: should be array [debug] [2022-10-18T08:43:29.371Z] Field ".hosting" in "firebase.json" is possibly invalid: should match some schema in anyOf

@bkendall
Copy link
Contributor

@ariel-dao looks like you're having a different issue with the "hosting" field in firebase.json. Opening a new issue with more details would be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants