firebase / firebase-tools

The Firebase Command Line Tools
MIT License
3.98k stars 918 forks source link

multiple errors on latest emulator suite #5404

Closed arisAlexis closed 1 year ago

arisAlexis commented 1 year ago

There are multiple problems here, I am at a loss and it has killed my project. Some of the problems exist in other isseus like #3616 but I have them all at once. The first issue that I am running a second emulator is always present even after reboot. Clearly the export directory you can see from the logs is not what I requested but some arbitrary random directory. Storage exits with ERROR without any clear reason, I have not even touched the storage.rules file. I am running the latest Java, node and firebase tools (the 3616 ticket reports that an old Java version might be a problem). Do I have 3 bugs simultaneously or all is caused by the same underlying misconfiguration which is not clear since I have just started a project and run firebase init on it?

[REQUIRED] Environment info

firebase-tools:11.20.0

Platform:Windows

[REQUIRED] Test case

[REQUIRED] Steps to reproduce

set GOOGLE_APPLICATION_CREDENTIALS=firebase-admin-sdk.json
firebase emulators:start --import=./export --export-on-exit

[REQUIRED] Expected behavior

Emulators start and exit normally

[REQUIRED] Actual behavior

set GOOGLE_APPLICATION_CREDENTIALS=firebase-admin-sdk.json
firebase emulators:start --import=./export --export-on-exit --debug

[2023-01-08T19:14:05.546Z] > 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"]
[2023-01-08T19:14:05.547Z] > authorizing via signed-in user (@gmail.com)
[2023-01-08T19:14:05.703Z] java version "19.0.1" 2022-10-18
Java(TM) SE Runtime Environment (build 19.0.1+10-21)

[2023-01-08T19:14:05.705Z] Java HotSpot(TM) 64-Bit Server VM (build 19.0.1+10-21, mixed mode, sharing)

[2023-01-08T19:14:05.720Z] Parsed Java major version: 19
i  emulators: Starting emulators: auth, functions, firestore, hosting, storage {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: auth, functions, firestore, hosting, storage"}}
[2023-01-08T19:14:05.733Z] [logging] Logging Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[2023-01-08T19:14:05.733Z] [auth] Authentication Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[2023-01-08T19:14:05.734Z] [firestore] Firestore Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[2023-01-08T19:14:05.734Z] [firestore.websocket] websocket server for firestore only supports listening on one address (127.0.0.1). Not listening on ::1
[2023-01-08T19:14:05.734Z] [hosting] Hosting Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[2023-01-08T19:14:05.734Z] [storage] Storage Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
!  ui: Emulator UI unable to start on port 4000, starting on 4001 instead. {"metadata":{"emulator":{"name":"ui"},"message":"Emulator UI unable to start on port 4000, starting on 4001 instead."}}
[2023-01-08T19:14:05.736Z] assigned listening specs for emulators {"user":{"hub":[{"address":"127.0.0.1","family":"IPv4","port":4400},{"address":"::1","family":"IPv6","port":4400}],"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":8080}],"firestore.websocket":[{"address":"127.0.0.1","family":"IPv4","port":9150}],"hosting":[{"address":"127.0.0.1","family":"IPv4","port":5000}],"storage":[{"address":"127.0.0.1","family":"IPv4","port":9199}],"ui":[{"address":"127.0.0.1","family":"IPv4","port":4001},{"address":"::1","family":"IPv6","port":4001}]},"metadata":{"message":"assigned listening specs for emulators"}}
!  emulators: It seems that you are running multiple instances of the emulator suite for project p. This may result in unexpected behavior.
[2023-01-08T19:14:05.745Z] [hub] writing locator at C:\Users\a\AppData\Local\Temp\hub-j.json
!  emulators: Could not find import/export metadata file, skipping data import! {"metadata":{"emulator":{"name":"hub"},"message":"Could not find import/export metadata file, \u001b[1mskipping data import!\u001b[22m"}}
[2023-01-08T19:14:05.756Z] [functions] Functions Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[2023-01-08T19:14:05.757Z] [eventarc] Eventarc Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[2023-01-08T19:14:05.757Z] 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}],"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":8080}],"firestore.websocket":[{"address":"127.0.0.1","family":"IPv4","port":9150}],"hosting":[{"address":"127.0.0.1","family":"IPv4","port":5000}],"storage":[{"address":"127.0.0.1","family":"IPv4","port":9199}],"ui":[{"address":"127.0.0.1","family":"IPv4","port":4001},{"address":"::1","family":"IPv6","port":4001}],"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"}}
!  functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: database, pubsub {"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\u001b[22m"}}
!  Your requested "node" version "16" doesn't match your global version "18". Using node@18 from host. {"metadata":{"emulator":{"name":"functions"},"message":"Your requested \"node\" version \"16\" doesn't match your global version \"18\". Using node@18 from host."}}
!  functions: Your GOOGLE_APPLICATION_CREDENTIALS environment variable points to firebase-admin-sdk.json. Non-emulated services will access production using these credentials. Be careful! {"metadata":{"emulator":{"name":"functions"},"message":"Your GOOGLE_APPLICATION_CREDENTIALS environment variable points to firebase-admin-sdk.json. Non-emulated services will access production using these credentials. Be careful!"}}
[2023-01-08T19:14:05.812Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/j/adminSdkConfig [none]
[2023-01-08T19:14:06.450Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/j/adminSdkConfig 200
[2023-01-08T19:14:06.450Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/j/adminSdkConfig {"projectId":"j","storageBucket":"j.appspot.com","locationId":"europe-west"}
[2023-01-08T19:14:06.471Z] Ignoring unsupported arg: auto_download {"metadata":{"emulator":{"name":"firestore"},"message":"Ignoring unsupported arg: auto_download"}}
[2023-01-08T19:14:06.472Z] Ignoring unsupported arg: single_project_mode_error {"metadata":{"emulator":{"name":"firestore"},"message":"Ignoring unsupported arg: single_project_mode_error"}}
[2023-01-08T19:14:06.472Z] Starting Firestore Emulator with command {"binary":"java","args":["-Dgoogle.cloud_firestore.debug_log_level=FINE","-Duser.language=en","-jar","C:\\Users\\a\\.cache\\firebase\\emulators\\cloud-firestore-emulator-v1.15.1.jar","--host","127.0.0.1","--port",8080,"--websocket_port",9150,"--project_id","j","--rules","C:\\code\\j\\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\",\"C:\\\\Users\\\\a\\\\.cache\\\\firebase\\\\emulators\\\\cloud-firestore-emulator-v1.15.1.jar\",\"--host\",\"127.0.0.1\",\"--port\",8080,\"--websocket_port\",9150,\"--project_id\",\"j\",\"--rules\",\"C:\\\\code\\\\j\\\\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}"}}
i  firestore: Firestore Emulator logging to firestore-debug.log {"metadata":{"emulator":{"name":"firestore"},"message":"Firestore Emulator logging to \u001b[1mfirestore-debug.log\u001b[22m"}}
+  firestore: Firestore Emulator UI websocket is running on 9150. {"metadata":{"emulator":{"name":"firestore"},"message":"Firestore Emulator UI websocket is running on 9150."}}
[2023-01-08T19:14:14.528Z] Ignoring unsupported arg: port {"metadata":{"emulator":{"name":"storage"},"message":"Ignoring unsupported arg: port"}}
[2023-01-08T19:14:15.715Z] Temp file directory for storage emulator: C:\Users\a\AppData\Local\Temp/firebase/storage/blobs {"metadata":{"emulator":{"name":"storage"},"message":"Temp file directory for storage emulator: C:\\Users\\a\\AppData\\Local\\Temp/firebase/storage/blobs"}}
[2023-01-08T19:14:15.725Z] >>> [apiv2][query] GET https://firebasehosting.googleapis.com/v1beta1/projects/j/sites

[2023-01-08T19:14:16.868Z] <<< [apiv2][status] GET https://firebasehosting.googleapis.com/v1beta1/projects/j/sites 200
[2023-01-08T19:14:16.869Z] <<< [apiv2][body] GET https://firebasehosting.googleapis.com/v1beta1/projects/j/sites {"sites":[{"name":"projects/j/sites/j","defaultUrl":"https://j.web.app","appId":"1:6251672e8886d","type":"DEFAULT_SITE"}]}
[2023-01-08T19:14:16.869Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/j/webApps/1:625167294232:web:43df3e55e18f86bee8886d/config [none]
[2023-01-08T19:14:17.826Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/j/webApps/1:625167294232:web:43df3e55e18f86bee8886d/config 200
[2023-01-08T19:14:17.826Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/j/webApps/1:625167294232:web:43df3e55e18f86bee8886d/config {"projectId":"j","appId":"1:625167294232:web:486d","storageBucket":"j.appspot.com","locationId":"europe-west","apiKey":"lala","authDomain":"j.firebaseapp.com","messagingSenderId":"625167294232","measurementId":"G-1V8BMS1TJ1"}
[2023-01-08T19:14:17.835Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/j[none]
[2023-01-08T19:14:18.208Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/j 200
[2023-01-08T19:14:18.208Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/j{"projectId":"j","projectNumber":"62232","displayName":"j","name":"projects/j","resources":{"hostingSite":"j","storageBucket":"j.appspot.com","locationId":"europe-west"},"state":"ACTIVE","etag":"1_b7bc1031-e8eb-452b-b59c-f0f6da4fda8b"}
i  hosting[j]: Serving hosting files from: public {"metadata":{"emulator":{"name":"hosting"},"message":"Serving hosting files from: \u001b[1mpublic\u001b[22m"}}
+  hosting[j]: Local server: http://127.0.0.1:5000 {"metadata":{"emulator":{"name":"hosting"},"message":"Local server: \u001b[4m\u001b[1mhttp://127.0.0.1:5000\u001b[22m\u001b[24m"}}
[2023-01-08T19:14:18.240Z] Ignoring unsupported arg: auto_download {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: auto_download"}}
[2023-01-08T19:14:18.240Z] Ignoring unsupported arg: port {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: port"}}
[2023-01-08T19:14:18.240Z] Starting Emulator UI with command {"binary":"node","args":["C:\\Users\\a\\.cache\\firebase\\emulators\\ui-v1.11.2\\server\\server.js"],"optionalArgs":[],"joinArgs":false} {"metadata":{"emulator":{"name":"ui"},"message":"Starting Emulator UI with command {\"binary\":\"node\",\"args\":[\"C:\\\\Users\\\\a\\\\.cache\\\\firebase\\\\emulators\\\\ui-v1.11.2\\\\server\\\\server.js\"],\"optionalArgs\":[],\"joinArgs\":false}"}}
i  ui: Emulator UI logging to ui-debug.log {"metadata":{"emulator":{"name":"ui"},"message":"Emulator UI logging to \u001b[1mui-debug.log\u001b[22m"}}
[2023-01-08T19:14:18.379Z] Web / API server started at 127.0.0.1:4001
 {"metadata":{"emulator":{"name":"ui"},"message":"Web / API server started at 127.0.0.1:4001\n"}}
[2023-01-08T19:14:18.380Z] Web / API server started at ::1:4001
 {"metadata":{"emulator":{"name":"ui"},"message":"Web / API server started at ::1:4001\n"}}
i  functions: Watching "C:\code\j\functions" for Cloud Functions... {"metadata":{"emulator":{"name":"functions"},"message":"Watching \"C:\\code\\j\\functions\" for Cloud Functions..."}}
[2023-01-08T19:14:18.515Z] Validating nodejs source
[2023-01-08T19:14:20.784Z] > [functions] package.json contents: {
  "name": "functions",
  "scripts": {
    "lint": "eslint --ext .js,.ts .",
    "build": "tsc",
    "build:watch": "tsc --watch",
    "serve": "npm run build && firebase emulators:start --only functions",
    "shell": "npm run build && firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "16"
  },
  "main": "lib/index.js",
  "dependencies": {
    "firebase-admin": "^10.0.2",
    "firebase-functions": "^4.1.1"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^5.12.0",
    "@typescript-eslint/parser": "^5.12.0",
    "eslint": "^8.9.0",
    "eslint-config-google": "^0.14.0",
    "eslint-plugin-import": "^2.25.4",
    "firebase-functions-test": "^0.2.0",
    "typescript": "^4.5.4"
  },
  "private": true
}
[2023-01-08T19:14:20.785Z] Building nodejs source
[2023-01-08T19:14:20.786Z] Could not find functions.yaml. Must use http discovery
[2023-01-08T19:14:21.126Z] Serving at port 9005

[2023-01-08T19:14:21.509Z] Got response from /__/functions.yaml {"endpoints":{"helloWorld":{"platform":"gcfv1","availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"serviceAccountEmail":null,"vpc":null,"httpsTrigger":{},"entryPoint":"helloWorld"}},"specVersion":"v1alpha1","requiredAPIs":[]}
[2023-01-08T19:14:21.516Z] shutdown requested via /__/quitquitquit

+  functions: Loaded functions definitions from source: helloWorld. {"metadata":{"emulator":{"name":"functions"},"message":"Loaded functions definitions from source: helloWorld."}}
+  functions[us-central1-helloWorld]: http function initialized (http://127.0.0.1:5001/j/us-central1/helloWorld). {"metadata":{"emulator":{"name":"functions"},"message":"\u001b[1mhttp\u001b[22m function initialized (http://127.0.0.1:5001/j/us-central1/helloWorld)."}}

┌─────────────────────────────────────────────────────────────┐
│ ✔  All emulators ready! It is now safe to connect your app. │
│ i  View Emulator UI at http://127.0.0.1:4001/               │
└─────────────────────────────────────────────────────────────┘

┌────────────────┬────────────────┬─────────────────────────────────┐
│ Emulator       │ Host:Port      │ View in Emulator UI             │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Authentication │ 127.0.0.1:9099 │ http://127.0.0.1:4001/auth      │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Functions      │ 127.0.0.1:5001 │ http://127.0.0.1:4001/functions │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Firestore      │ 127.0.0.1:8080 │ http://127.0.0.1:4001/firestore │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Hosting        │ 127.0.0.1:5000 │ n/a                             │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Storage        │ 127.0.0.1:9199 │ http://127.0.0.1:4001/storage   │
└────────────────┴────────────────┴─────────────────────────────────┘
  Emulator Hub running at 127.0.0.1:4400
  Other reserved ports: 4500, 9150

Issues? Report them at https://github.com/firebase/firebase-tools/issues and attach the *-debug.log files.

[2023-01-08T19:19:35.107Z] Received signal SIGINT (Ctrl-C) 1

i  emulators: Received SIGINT (Ctrl-C) for the first time. Starting a clean shutdown.
i  emulators: Please wait for a clean shutdown or send the SIGINT (Ctrl-C) signal again to stop right now.
i  Automatically exporting data using --export-on-exit "./export" please wait for the export to finish...
[2023-01-08T19:19:35.111Z] >>> [apiv2][query] GET http://127.0.0.1:4400/ [none]

Error: Storage Emulator Rules runtime exited unexpectedly.
[2023-01-08T19:19:35.120Z] <<< [apiv2][status] GET http://127.0.0.1:4400/ 200
[2023-01-08T19:19:35.121Z] <<< [apiv2][body] GET http://127.0.0.1:4400/ {"version":"11.20.0","origins":["http://127.0.0.1:4400","http://[::1]:4400"],"host":"127.0.0.1","port":4400}
i  Found running emulator hub for project jat http://127.0.0.1:4400
i  Exporting data to: C:\code\j\export
[2023-01-08T19:19:35.123Z] >>> [apiv2][query] GET http://127.0.0.1:4400/ [none]
[2023-01-08T19:19:35.126Z] <<< [apiv2][status] GET http://127.0.0.1:4400/ 200
[2023-01-08T19:19:35.126Z] <<< [apiv2][body] GET http://127.0.0.1:4400/ {"version":"11.20.0","origins":["http://127.0.0.1:4400","http://[::1]:4400"],"host":"127.0.0.1","port":4400}
[2023-01-08T19:19:35.127Z] >>> [apiv2][query] POST http://127.0.0.1:4400/_admin/export [none]
[2023-01-08T19:19:35.127Z] >>> [apiv2][body] POST http://127.0.0.1:4400/_admin/export {"path":"C:\\code\\j\\export","initiatedBy":"exit"}
i  emulators: Received export request. Exporting data to C:\code\j\export.
[2023-01-08T19:19:35.146Z] >>> [apiv2][query] POST http://127.0.0.1:8080/emulator/v1/projects/j:export [none]
[2023-01-08T19:19:35.146Z] >>> [apiv2][body] POST http://127.0.0.1:8080/emulator/v1/projects/j:export {"database":"projects/j/databases/(default)","export_directory":"firebase-export-1673205575141S1OrVs","export_name":"firestore_export"}
[2023-01-08T19:19:35.286Z] <<< [apiv2][status] POST http://127.0.0.1:8080/emulator/v1/projects/j:export 200
[2023-01-08T19:19:35.286Z] <<< [apiv2][body] POST http://127.0.0.1:8080/emulator/v1/projects/j:export {}
[2023-01-08T19:19:35.289Z] Exporting auth users in Project j to firebase-export-1673205575141S1OrVs\auth_export\accounts.json
[2023-01-08T19:19:35.301Z] Exporting project config in Project j to firebase-export-1673205575141S1OrVs\auth_export\accounts.json
[2023-01-08T19:19:35.310Z] >>> [apiv2][query] POST http://127.0.0.1:9199/internal/export [none]
[2023-01-08T19:19:35.311Z] >>> [apiv2][body] POST http://127.0.0.1:9199/internal/export {"path":"firebase-export-1673205575141S1OrVs\\storage_export","initiatedBy":"exit"}
[2023-01-08T19:19:35.314Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/j/adminSdkConfig [none]
google-oss-bot commented 1 year ago

This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.

christhompsongoogle commented 1 year ago

Hi arisAlexis,

The export directory is based on your working directory which appears to be c:\code\j\

If the emulator is still running after a restart that's not expected. By restart do you mean restarting the emulators or restarting the machine + OS?

Does storage exit unexpectedly after a Ctrl+C? Can you post your storage rules and firebase.json files?

google-oss-bot commented 1 year ago

Hey @arisAlexis. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 1 year ago

Since there haven't been any recent updates here, I am going to close this issue.

@arisAlexis if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.