I'm trying to start local firebase emulators to test Cloud Functions, but when I use the command "firebase emulators:start" or "firebase emulators:start --only functions" I get an "Error: An unexpected error has occurred". Looking deeply into the log, I found out that there is a javascript error showing up:
at new Table (/usr/local/lib/node_modules/firebase-tools/node_modules/cli-table/lib/index.js:51:15)
at Command.actionFn (/usr/local/lib/node_modules/firebase-tools/lib/commands/emulators-start.js:47:33)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Can you please help me on this issue?
My firebase.debug file:
[debug] [2021-11-18T14:17:55.225Z] ----------------------------------------------------------------------
[debug] [2021-11-18T14:17:55.227Z] Command: /usr/local/bin/node /usr/local/bin/firebase emulators:start --only functions
[debug] [2021-11-18T14:17:55.228Z] CLI Version: 9.22.0
[debug] [2021-11-18T14:17:55.228Z] Platform: darwin
[debug] [2021-11-18T14:17:55.228Z] Node Version: v14.16.1
[debug] [2021-11-18T14:17:55.228Z] Time: Thu Nov 18 2021 11:17:55 GMT-0300
[debug] [2021-11-18T14:17:55.228Z] ----------------------------------------------------------------------
[debug]
[debug] [2021-11-18T14:17:55.279Z] > 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] [2021-11-18T14:17:55.279Z] > authorizing via signed-in user
[info] i emulators: Starting emulators: functions {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: functions"}}
[warn] ⚠ emulators: It seems that you are running multiple instances of the emulator suite for project myproject-cloud. This may result in unexpected behavior.
[debug] [2021-11-18T14:17:55.296Z] [hub] writing locator at /var/folders/fh/z2w8wkl147gd2q4wvc281x5r0000gn/T/hub-myproject-cloud.json
[warn] ⚠ functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: auth, firestore, database, hosting, 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[1mauth, firestore, database, hosting, pubsub, storage\u001b[22m"}}
[info] ✔ functions: Using node#14 from host. {"metadata":{"emulator":{"name":"functions"},"message":"Using node#14 from host."}}
[debug] [2021-11-18T14:17:55.335Z] defaultcredentials: writing to file /Users/artiste/.config/firebase/artiste_gmail_com_application_default_credentials.json
[debug] [2021-11-18T14:17:55.339Z] Setting GAC to /Users/artiste/.config/firebase/artiste_gmail_com_application_default_credentials.json {"metadata":{"emulator":{"name":"functions"},"message":"Setting GAC to /Users/artiste/.config/firebase/artiste_gmail_com_application_default_credentials.json"}}
[debug] [2021-11-18T14:17:55.342Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/myproject-cloud/adminSdkConfig [none]
[debug] [2021-11-18T14:17:56.394Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/myproject-cloud/adminSdkConfig 200
[debug] [2021-11-18T14:17:56.394Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/myproject-cloud/adminSdkConfig {"projectId":"myproject-cloud","storageBucket":"myproject-cloud.appspot.com","locationId":"southamerica-east1"}
[warn] ⚠ ui: Emulator UI unable to start on port 4000, starting on 4010 instead. {"metadata":{"emulator":{"name":"ui"},"message":"Emulator UI unable to start on port 4000, starting on 4010 instead."}}
[debug] [2021-11-18T14:17:56.965Z] Ignoring unsupported arg: auto_download {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: auto_download"}}
[debug] [2021-11-18T14:17:56.965Z] Ignoring unsupported arg: port {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: port"}}
[debug] [2021-11-18T14:17:56.965Z] Starting Emulator UI with command {"binary":"node","args":["/Users/artiste/.cache/firebase/emulators/ui-v1.6.4/server.bundle.js"],"optionalArgs":[],"joinArgs":false} {"metadata":{"emulator":{"name":"ui"},"message":"Starting Emulator UI with command {\"binary\":\"node\",\"args\":[\"/Users/artiste/.cache/firebase/emulators/ui-v1.6.4/server.bundle.js\"],\"optionalArgs\":[],\"joinArgs\":false}"}}
[info] i ui: Emulator UI logging to ui-debug.log {"metadata":{"emulator":{"name":"ui"},"message":"Emulator UI logging to \u001b[1mui-debug.log\u001b[22m"}}
[debug] [2021-11-18T14:17:57.055Z] Web / API server started at localhost:4010
{"metadata":{"emulator":{"name":"ui"},"message":"Web / API server started at localhost:4010\n"}}
[info] i functions: Watching "/Users/artiste/Developer/myproject_functions/functions" for Cloud Functions... {"metadata":{"emulator":{"name":"functions"},"message":"Watching \"/Users/artiste/Developer/myproject_functions/functions\" for Cloud Functions..."}}
[debug] [2021-11-18T14:17:57.241Z] [worker-pool] addWorker(~diagnostic~) {"metadata":{"emulator":{"name":"functions"},"message":"[worker-pool] addWorker(~diagnostic~)"}}
[debug] [2021-11-18T14:17:57.241Z] [worker-pool] Adding worker with key ~diagnostic~, total=1 {"metadata":{"emulator":{"name":"functions"},"message":"[worker-pool] Adding worker with key ~diagnostic~, total=1"}}
[debug] [2021-11-18T14:17:57.242Z] [worker-pool] submitWork(triggerId=) {"metadata":{"emulator":{"name":"functions"},"message":"[worker-pool] submitWork(triggerId=)"}}
[debug] [2021-11-18T14:17:57.242Z] [worker-~diagnostic~-ef847c42-9516-4e42-bacf-72e8e9feb533]: Assigning socketPath: /var/folders/fh/z2w8wkl147gd2q4wvc281x5r0000gn/T/fire_emu_52240.sock {"metadata":{"emulator":{"name":"functions"},"message":"[worker-~diagnostic~-ef847c42-9516-4e42-bacf-72e8e9feb533]: Assigning socketPath: /var/folders/fh/z2w8wkl147gd2q4wvc281x5r0000gn/T/fire_emu_52240.sock"}}
[debug] [2021-11-18T14:17:57.242Z] [worker-~diagnostic~-ef847c42-9516-4e42-bacf-72e8e9feb533]: BUSY {"metadata":{"emulator":{"name":"functions"},"message":"[worker-~diagnostic~-ef847c42-9516-4e42-bacf-72e8e9feb533]: BUSY"}}
[debug] [2021-11-18T14:17:57.363Z] [runtime-status] [52240] Functions runtime initialized. {"cwd":"/Users/artiste/Developer/myproject_functions/functions","node_version":"14.16.1"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] Functions runtime initialized. {\"cwd\":\"/Users/artiste/Developer/myproject_functions/functions\",\"node_version\":\"14.16.1\"}"}}
[debug] [2021-11-18T14:17:57.364Z] [runtime-status] [52240] Disabled runtime features: undefined {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] Disabled runtime features: undefined"}}
[debug] [2021-11-18T14:17:57.367Z] [runtime-status] [52240] Resolved module firebase-admin {"declared":true,"installed":true,"version":"9.12.0","resolution":"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-admin/lib/index.js"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] Resolved module firebase-admin {\"declared\":true,\"installed\":true,\"version\":\"9.12.0\",\"resolution\":\"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-admin/lib/index.js\"}"}}
[debug] [2021-11-18T14:17:57.370Z] [runtime-status] [52240] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.16.0","resolution":"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-functions/lib/index.js"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] Resolved module firebase-functions {\"declared\":true,\"installed\":true,\"version\":\"3.16.0\",\"resolution\":\"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-functions/lib/index.js\"}"}}
[debug] [2021-11-18T14:17:57.372Z] [runtime-status] [52240] Outgoing network have been stubbed. [{"name":"http","status":"mocked"},{"name":"http","status":"mocked"},{"name":"https","status":"mocked"},{"name":"https","status":"mocked"},{"name":"net","status":"mocked"}] {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] Outgoing network have been stubbed. [{\"name\":\"http\",\"status\":\"mocked\"},{\"name\":\"http\",\"status\":\"mocked\"},{\"name\":\"https\",\"status\":\"mocked\"},{\"name\":\"https\",\"status\":\"mocked\"},{\"name\":\"net\",\"status\":\"mocked\"}]"}}
[debug] [2021-11-18T14:17:57.372Z] [runtime-status] [52240] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.16.0","resolution":"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-functions/lib/index.js"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] Resolved module firebase-functions {\"declared\":true,\"installed\":true,\"version\":\"3.16.0\",\"resolution\":\"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-functions/lib/index.js\"}"}}
[debug] [2021-11-18T14:17:57.429Z] [runtime-status] [52240] Checked functions.config() {"config":{}} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] Checked functions.config() {\"config\":{}}"}}
[debug] [2021-11-18T14:17:57.429Z] [runtime-status] [52240] firebase-functions has been stubbed. {"functionsResolution":{"declared":true,"installed":true,"version":"3.16.0","resolution":"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-functions/lib/index.js"}} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] firebase-functions has been stubbed. {\"functionsResolution\":{\"declared\":true,\"installed\":true,\"version\":\"3.16.0\",\"resolution\":\"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-functions/lib/index.js\"}}"}}
[debug] [2021-11-18T14:17:57.430Z] [runtime-status] [52240] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.16.0","resolution":"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-functions/lib/index.js"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] Resolved module firebase-functions {\"declared\":true,\"installed\":true,\"version\":\"3.16.0\",\"resolution\":\"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-functions/lib/index.js\"}"}}
[debug] [2021-11-18T14:17:57.430Z] [runtime-status] [52240] Resolved module firebase-admin {"declared":true,"installed":true,"version":"9.12.0","resolution":"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-admin/lib/index.js"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] Resolved module firebase-admin {\"declared\":true,\"installed\":true,\"version\":\"9.12.0\",\"resolution\":\"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-admin/lib/index.js\"}"}}
[debug] [2021-11-18T14:17:57.431Z] [runtime-status] [52240] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.16.0","resolution":"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-functions/lib/index.js"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] Resolved module firebase-functions {\"declared\":true,\"installed\":true,\"version\":\"3.16.0\",\"resolution\":\"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-functions/lib/index.js\"}"}}
[debug] [2021-11-18T14:17:57.431Z] [runtime-status] [52240] firebase-admin has been stubbed. {"adminResolution":{"declared":true,"installed":true,"version":"9.12.0","resolution":"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-admin/lib/index.js"}} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] firebase-admin has been stubbed. {\"adminResolution\":{\"declared\":true,\"installed\":true,\"version\":\"9.12.0\",\"resolution\":\"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-admin/lib/index.js\"}}"}}
[debug] [2021-11-18T14:17:57.433Z] [runtime-status] [52240] initializeApp(DEFAULT) {"storageBucket":"myproject-cloud.appspot.com","projectId":"myproject-cloud"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] initializeApp(DEFAULT) {\"storageBucket\":\"myproject-cloud.appspot.com\",\"projectId\":\"myproject-cloud\"}"}}
[debug] [2021-11-18T14:17:57.436Z] addAuthTrigger {"eventTrigger":{"resource":"projects/myproject-cloud","eventType":"providers/firebase.auth/eventTypes/user.create","service":"firebaseauth.googleapis.com"}}
[info] ✔ functions[us-central1-createWallet]: auth function initialized. {"metadata":{"emulator":{"name":"functions"},"message":"\u001b[1mauth\u001b[22m function initialized."}}
[info] ✔ functions[us-central1-addMessage]: http function initialized (http://localhost:5001/myproject-cloud/us-central1/addMessage). {"metadata":{"emulator":{"name":"functions"},"message":"\u001b[1mhttp\u001b[22m function initialized (http://localhost:5001/myproject-cloud/us-central1/addMessage)."}}
[info] i functions[us-central1-makeUppercase]: function ignored because the firestore emulator does not exist or is not running. {"metadata":{"emulator":{"name":"functions"},"message":"function ignored because the firestore emulator does not exist or is not running."}}
[debug] [2021-11-18T14:17:57.440Z] [worker-~diagnostic~-ef847c42-9516-4e42-bacf-72e8e9feb533]: IDLE {"metadata":{"emulator":{"name":"functions"},"message":"[worker-~diagnostic~-ef847c42-9516-4e42-bacf-72e8e9feb533]: IDLE"}}
[debug] [2021-11-18T14:17:57.687Z] TypeError: Cannot read property 'rows' of undefined
at new Table (/usr/local/lib/node_modules/firebase-tools/node_modules/cli-table/lib/index.js:51:15)
at Command.actionFn (/usr/local/lib/node_modules/firebase-tools/lib/commands/emulators-start.js:47:33)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
[error]
[error] Error: An unexpected error has occurred.
My firebase.json file:
{
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
]
},
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"hosting": {
"public": "dist",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
"emulators": {
"firestore": {
"port": 5002
}
}
}
Thank you.
This seemed to be a bug in Firebase.
It's gone after updating to the latest version (9.23.0) with for example:
npm i -g firebase-tools#latest
Related
I followed some tutorials to use local emulators on my laptop.
the installation went well and I could start the emulator.
I see the realtime Database in green and can see the empty DB.
But from there, I am not able to do anything at all:
Import a DB: I get the following error: "NetworkError when attempting to fetch resource."
Adding some fields/Values in the Database from the GUI:
- I don't have any "+" sign to add values.
- I cannot save the values I put.
- I can see "Edit" or "Delete" button, but they have no effect...
There is something going wrong somewhere and that may be due to some config, but I don't know what that should be.
I don't find documentation relatively and did not find any "Google" article relatively.
Any support would be very welcome as I am currently blocked with my project.
Thank you.
LOGS:
database-debug.log
*Picked up JAVA_TOOL_OPTIONS: -Xmx4g
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/root/.cache/firebase/emulators/firebase-database-emulator-v4.9.0.jar) to field sun.nio.ch.SelectorImpl.selectedKeys
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
17:34:03.761 [NamespaceSystem-akka.actor.default-dispatcher-5] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
17:34:03.894 [main] INFO com.firebase.server.forge.App$ - Listening at 127.0.0.1:9000*
firebase-debug.log
*_[debug] [2022-10-01T00:34:02.410Z] ----------------------------------------------------------------------
[debug] [2022-10-01T00:34:02.412Z] Command: /usr/local/bin/firebase /root/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/bin/firebase emulators:start
[debug] [2022-10-01T00:34:02.412Z] CLI Version: 11.12.0
[debug] [2022-10-01T00:34:02.412Z] Platform: linux
[debug] [2022-10-01T00:34:02.412Z] Node Version: v16.16.0
[debug] [2022-10-01T00:34:02.412Z] Time: Fri Sep 30 2022 17:34:02 GMT-0700 (Pacific Daylight Time)
[debug] [2022-10-01T00:34:02.413Z] ----------------------------------------------------------------------
[debug]
[debug] [2022-10-01T00:34:02.471Z] > 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-01T00:34:02.472Z] > authorizing via signed-in user (ebonnefoy#rbbn.com)
[debug] [2022-10-01T00:34:02.481Z] Picked up JAVA_TOOL_OPTIONS: -Xmx4g
[debug] [2022-10-01T00:34:02.513Z] openjdk version "11.0.16" 2022-07-19
[debug] [2022-10-01T00:34:02.514Z] OpenJDK Runtime Environment (build 11.0.16+8-post-Debian-1)
OpenJDK 64-Bit Server VM (build 11.0.16+8-post-Debian-1, mixed mode, sharing)
[debug] [2022-10-01T00:34:02.523Z] Parsed Java major version: 11
[info] i emulators: Starting emulators: auth, database {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: auth, database"}}
[debug] [2022-10-01T00:34:02.536Z] [hub] writing locator at /tmp/hub-testemul01.json
[debug] [2022-10-01T00:34:02.543Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/testemul01 [none]
[debug] [2022-10-01T00:34:02.747Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/testemul01 200
[debug] [2022-10-01T00:34:02.748Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/testemul01 {"projectId":"testemul01","projectNumber":"820099885379","displayName":"testemul1","name":"projects/testemul01","resources":{"hostingSite":"testemul01"},"state":"ACTIVE","etag":"1_e1300143-b10e-4def-88a1-a6736b7b5a04"}
[debug] [2022-10-01T00:34:02.749Z] database rules config: []
[warn] ⚠ database: Did not find a Realtime Database rules file specified in a firebase.json config file. 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. {"metadata":{"emulator":{"name":"database"},"message":"Did not find a Realtime Database rules file specified in a firebase.json config file. 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."}}
[debug] [2022-10-01T00:34:02.758Z] Ignoring unsupported arg: projectId {"metadata":{"emulator":{"name":"database"},"message":"Ignoring unsupported arg: projectId"}}
[debug] [2022-10-01T00:34:02.758Z] Ignoring unsupported arg: auto_download {"metadata":{"emulator":{"name":"database"},"message":"Ignoring unsupported arg: auto_download"}}
[debug] [2022-10-01T00:34:02.758Z] Ignoring unsupported arg: rules {"metadata":{"emulator":{"name":"database"},"message":"Ignoring unsupported arg: rules"}}
[debug] [2022-10-01T00:34:02.758Z] Starting Database Emulator with command {"binary":"java","args":["-Duser.language=en","-jar","/root/.cache/firebase/emulators/firebase-database-emulator-v4.9.0.jar","--host","127.0.0.1","--port",9000],"optionalArgs":["port","host","functions_emulator_port","functions_emulator_host"],"joinArgs":false} {"metadata":{"emulator":{"name":"database"},"message":"Starting Database Emulator with command {"binary":"java","args":["-Duser.language=en","-jar","/root/.cache/firebase/emulators/firebase-database-emulator-v4.9.0.jar","--host","127.0.0.1","--port",9000],"optionalArgs":["port","host","functions_emulator_port","functions_emulator_host"],"joinArgs":false}"}}
[info] i database: Database Emulator logging to database-debug.log {"metadata":{"emulator":{"name":"database"},"message":"Database Emulator logging to \u001b[1mdatabase-debug.log\u001b[22m"}}
[debug] [2022-10-01T00:34:02.771Z] Picked up JAVA_TOOL_OPTIONS: -Xmx4g
{"metadata":{"emulator":{"name":"database"},"message":"Picked up JAVA_TOOL_OPTIONS: -Xmx4g\n"}}
[debug] [2022-10-01T00:34:03.258Z] WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/root/.cache/firebase/emulators/firebase-database-emulator-v4.9.0.jar) to field sun.nio.ch.SelectorImpl.selectedKeys
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
{"metadata":{"emulator":{"name":"database"},"message":"WARNING: An illegal reflective access operation has occurred\nWARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/root/.cache/firebase/emulators/firebase-database-emulator-v4.9.0.jar) to field sun.nio.ch.SelectorImpl.selectedKeys\nWARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil\nWARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations\nWARNING: All illegal access operations will be denied in a future release\n"}}
[debug] [2022-10-01T00:34:03.763Z] 17:34:03.761 [NamespaceSystem-akka.actor.default-dispatcher-5] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
{"metadata":{"emulator":{"name":"database"},"message":"17:34:03.761 [NamespaceSystem-akka.actor.default-dispatcher-5] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started\n"}}
[debug] [2022-10-01T00:34:03.895Z] 17:34:03.894 [main] INFO com.firebase.server.forge.App$ - Listening at 127.0.0.1:9000
{"metadata":{"emulator":{"name":"database"},"message":"17:34:03.894 [main] INFO com.firebase.server.forge.App$ - Listening at 127.0.0.1:9000\n"}}
[debug] [2022-10-01T00:34:09.740Z] Ignoring unsupported arg: auto_download {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: auto_download"}}
[debug] [2022-10-01T00:34:09.740Z] Ignoring unsupported arg: port {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: port"}}
[debug] [2022-10-01T00:34:09.741Z] Starting Emulator UI with command {"binary":"node","args":["/root/.cache/firebase/emulators/ui-v1.9.0/server/server.js"],"optionalArgs":[],"joinArgs":false} {"metadata":{"emulator":{"name":"ui"},"message":"Starting Emulator UI with command {"binary":"node","args":["/root/.cache/firebase/emulators/ui-v1.9.0/server/server.js"],"optionalArgs":[],"joinArgs":false}"}}
[info] i ui: Emulator UI logging to ui-debug.log {"metadata":{"emulator":{"name":"ui"},"message":"Emulator UI logging to \u001b[1mui-debug.log\u001b[22m"}}
[debug] [2022-10-01T00:34:09.903Z] Web / API server started at 127.0.0.1:4000
{"metadata":{"emulator":{"name":"ui"},"message":"Web / API server started at 127.0.0.1:4000\n"}}
[info]
┌─────────────────────────────────────────────────────────────┐
│ ✔ All emulators ready! It is now safe to connect your app. │
│ i View Emulator UI at http://127.0.0.1:4000 │
└─────────────────────────────────────────────────────────────┘
┌────────────────┬────────────────┬────────────────────────────────┐
│ Emulator │ Host:Port │ View in Emulator UI │
├────────────────┼────────────────┼────────────────────────────────┤
│ Authentication │ 127.0.0.1:9099 │ http://127.0.0.1:4000/auth │
├────────────────┼────────────────┼────────────────────────────────┤
│ Database │ 127.0.0.1:9000 │ http://127.0.0.1:4000/database │
└────────────────┴────────────────┴────────────────────────────────┘
Emulator Hub running at localhost:4400
Other reserved ports: 4500*
I have my big NodeJS app using Firebase, it was last modified in 2018. Since at that time i was learning firebase and firebase hosting from examples. index.js file kinda became huge, it contains routes as well as definitions of Firebase Functions. Currently i wanted to modularize it. So proceeded to upgrade Firebase and dependencies. Something new i had noticied is Firebase Emulators, currently firebase server command is not working. Firebase emulator:start seems to start the app but mostly times out like out of 30 attempts only once it works.
Version info
Firebase : 11.5.0
Below is the package.json in functions folder.
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"serve": "firebase emulators:start --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "16"
},
"main": "index.js",
"dependencies": {
"#grpc/grpc-js": "^1.6.8",
"#sendgrid/mail": "^6.3.1",
"async": "^2.6.1",
"bluebird": "^3.5.3",
"ejs": "^3.1.8",
"express": "^4.16.3",
"firebase": "^8.2.2",
"firebase-admin": "^10.0.2",
"firebase-functions": "^3.18.0"
},
"devDependencies": {
"firebase-functions-test": "^0.2.0"
},
"private": true
}
Below is the firebase.json, emulator key/value is the new one, rest all i had from 2018 and no changes.
{
"database": {
"rules": "database.rules.json"
},
"functions": {
"ignore": [
"node_modules",
".git",
"firebase-debug.log",
"firebase-debug.*.log"
],
"source": "functions"
},
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"headers": [
{
"source": "/**",
"headers": [
{
"key": "Cache-Control",
"value": "no-cache, no-store, must-revalidate"
}
]
}
],
"rewrites": [
{
"source": "**",
"function": "app"
}
]
},
"emulators": {
"hosting": {
"port": 5000
},
"ui": {
"enabled": false
},
"functions": {
"port": 5001
},
"database": {
"port": 9000
}
}
}
After i do the firebase emulators:start
In the browser, i am getting
Timed out waiting for function to respond.
In the firebase-debug.log, i see below messages. It says BUSY at multiple places but not sure whats BUSY as it being run locally.
[debug] [2022-08-10T05:47:37.602Z] [work-queue] {"queueLength":1,"workRunningCount":0}
[debug] [2022-08-10T05:47:37.602Z] [work-queue] {"queueLength":0,"workRunningCount":1}
[debug] [2022-08-10T05:47:37.602Z] Accepted request GET /prj-out22-20180718/us-central1/app/ --> us-central1-app
[debug] [2022-08-10T05:47:37.626Z] [worker-pool] addWorker(us-central1-app) {"metadata":{"emulator":{"name":"functions"},"message":"[worker-pool] addWorker(us-central1-app)"}}
[debug] [2022-08-10T05:47:37.627Z] [worker-pool] Adding worker with key us-central1-app, total=2 {"metadata":{"emulator":{"name":"functions"},"message":"[worker-pool] Adding worker with key us-central1-app, total=2"}}
[debug] [2022-08-10T05:47:37.627Z] [worker-pool] submitWork(triggerId=us-central1-app) {"metadata":{"emulator":{"name":"functions"},"message":"[worker-pool] submitWork(triggerId=us-central1-app)"}}
[debug] [2022-08-10T05:47:37.628Z] [worker-us-central1-app-37b679fa-3191-43c2-9b15-aad75042f00c]: BUSY {"metadata":{"emulator":{"name":"functions"},"message":"[worker-us-central1-app-37b679fa-3191-43c2-9b15-aad75042f00c]: BUSY"}}
[debug] FirebaseError: Failed to load function.
at Timeout._onTimeout (C:\Users\Sushanth\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsRuntimeWorker.js:104:24)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) {"metadata":{"emulator":{"name":"functions"},"message":{"name":"FirebaseError","children":[],"exit":1,"message":"Failed to load function.","status":500}}}
And when it works, i see below
[debug] [2022-08-10T06:05:11.950Z] [worker-us-central1-app-873dbf58-beeb-4662-bbc0-23271dfe56e0]: BUSY {"metadata":{"emulator":{"name":"functions"},"message":"[worker-us-central1-app-873dbf58-beeb-4662-bbc0-23271dfe56e0]: BUSY"}}
[debug] [2022-08-10T06:05:16.977Z] [runtime-status] [13808] Resolved module firebase-admin {"declared":true,"installed":true,"version":"10.3.0","resolution":"D:\\BigData\\13. Firebase\\FB-BTD\\kickbear\\functions\\node_modules\\firebase-admin\\lib\\index.js"} {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-app"},"extension":{},"message":"[runtime-status] [13808] Resolved module firebase-admin {\"declared\":true,\"installed\":true,\"version\":\"10.3.0\",\"resolution\":\"D:\\\\BigData\\\\13. Firebase\\\\FB-BTD\\\\kickbear\\\\functions\\\\node_modules\\\\firebase-admin\\\\lib\\\\index.js\"}"}}
[debug] [2022-08-10T06:05:16.980Z] [runtime-status] [13808] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.22.0","resolution":"D:\\BigData\\13. Firebase\\FB-BTD\\kickbear\\functions\\node_modules\\firebase-functions\\lib\\index.js"} {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-app"},"extension":{},"message":"[runtime-status] [13808] Resolved module firebase-functions {\"declared\":true,\"installed\":true,\"version\":\"3.22.0\",\"resolution\":\"D:\\\\BigData\\\\13. Firebase\\\\FB-BTD\\\\kickbear\\\\functions\\\\node_modules\\\\firebase-functions\\\\lib\\\\index.js\"}"}}
[debug] [2022-08-10T06:05:16.981Z] [runtime-status] [13808] Found local functions config: D:\BigData\13. Firebase\FB-BTD\kickbear\functions/.runtimeconfig.json {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-app"},"extension":{},"message":"[runtime-status] [13808] Found local functions config: D:\\BigData\\13. Firebase\\FB-BTD\\kickbear\\functions/.runtimeconfig.json"}}
[debug] [2022-08-10T06:05:16.981Z] [runtime-status] [13808] Outgoing network have been stubbed. [{"name":"http","status":"mocked"},{"name":"http","status":"mocked"},{"name":"https","status":"mocked"},{"name":"https","status":"mocked"},{"name":"net","status":"mocked"}] {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-app"},"extension":{},"message":"[runtime-status] [13808] Outgoing network have been stubbed. [{\"name\":\"http\",\"status\":\"mocked\"},{\"name\":\"http\",\"status\":\"mocked\"},{\"name\":\"https\",\"status\":\"mocked\"},{\"name\":\"https\",\"status\":\"mocked\"},{\"name\":\"net\",\"status\":\"mocked\"}]"}}
[debug] [2022-08-10T06:05:16.984Z] [runtime-status] [13808] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.22.0","resolution":"D:\\BigData\\13. Firebase\\FB-BTD\\kickbear\\functions\\node_modules\\firebase-functions\\lib\\index.js"} {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-app"},"extension":{},"message":"[runtime-status] [13808] Resolved module firebase-functions {\"declared\":true,\"installed\":true,\"version\":\"3.22.0\",\"resolution\":\"D:\\\\BigData\\\\13. Firebase\\\\FB-BTD\\\\kickbear\\\\functions\\\\node_modules\\\\firebase-functions\\\\lib\\\\index.js\"}"}}
[debug] [2022-08-10T06:05:17.175Z] [runtime-status] [13808] Checked functions.config() {"config":{}} {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-app"},"extension":{},"message":"[runtime-status] [13808] Checked functions.config() {\"config\":{}}"}}
[debug] [2022-08-10T06:05:17.175Z] [runtime-status] [13808] firebase-functions has been stubbed. {"functionsResolution":{"declared":true,"installed":true,"version":"3.22.0","resolution":"D:\\BigData\\13. Firebase\\FB-BTD\\kickbear\\functions\\node_modules\\firebase-functions\\lib\\index.js"}} {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-app"},"extension":{},"message":"[runtime-status] [13808] firebase-functions has been stubbed. {\"functionsResolution\":{\"declared\":true,\"installed\":true,\"version\":\"3.22.0\",\"resolution\":\"D:\\\\BigData\\\\13. Firebase\\\\FB-BTD\\\\kickbear\\\\functions\\\\node_modules\\\\firebase-functions\\\\lib\\\\index.js\"}}"}}
[debug] [2022-08-10T06:05:17.178Z] [runtime-status] [13808] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.22.0","resolution":"D:\\BigData\\13. Firebase\\FB-BTD\\kickbear\\functions\\node_modules\\firebase-functions\\lib\\index.js"} {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-app"},"extension":{},"message":"[runtime-status] [13808] Resolved module firebase-functions {\"declared\":true,\"installed\":true,\"version\":\"3.22.0\",\"resolution\":\"D:\\\\BigData\\\\13. Firebase\\\\FB-BTD\\\\kickbear\\\\functions\\\\node_modules\\\\firebase-functions\\\\lib\\\\index.js\"}"}}
[debug] [2022-08-10T06:05:17.183Z] [runtime-status] [13808] Resolved module firebase-admin {"declared":true,"installed":true,"version":"10.3.0","resolution":"D:\\BigData\\13. Firebase\\FB-BTD\\kickbear\\functions\\node_modules\\firebase-admin\\lib\\index.js"} {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-app"},"extension":{},"message":"[runtime-status] [13808] Resolved module firebase-admin {\"declared\":true,\"installed\":true,\"version\":\"10.3.0\",\"resolution\":\"D:\\\\BigData\\\\13. Firebase\\\\FB-BTD\\\\kickbear\\\\functions\\\\node_modules\\\\firebase-admin\\\\lib\\\\index.js\"}"}}
[debug] [2022-08-10T06:05:17.186Z] [runtime-status] [13808] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.22.0","resolution":"D:\\BigData\\13. Firebase\\FB-BTD\\kickbear\\functions\\node_modules\\firebase-functions\\lib\\index.js"} {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-app"},"extension":{},"message":"[runtime-status] [13808] Resolved module firebase-functions {\"declared\":true,\"installed\":true,\"version\":\"3.22.0\",\"resolution\":\"D:\\\\BigData\\\\13. Firebase\\\\FB-BTD\\\\kickbear\\\\functions\\\\node_modules\\\\firebase-functions\\\\lib\\\\index.js\"}"}}
[debug] [2022-08-10T06:05:17.186Z] [runtime-status] [13808] firebase-admin has been stubbed. {"adminResolution":{"declared":true,"installed":true,"version":"10.3.0","resolution":"D:\\BigData\\13. Firebase\\FB-BTD\\kickbear\\functions\\node_modules\\firebase-admin\\lib\\index.js"}} {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-app"},"extension":{},"message":"[runtime-status] [13808] firebase-admin has been stubbed. {\"adminResolution\":{\"declared\":true,\"installed\":true,\"version\":\"10.3.0\",\"resolution\":\"D:\\\\BigData\\\\13. Firebase\\\\FB-BTD\\\\kickbear\\\\functions\\\\node_modules\\\\firebase-admin\\\\lib\\\\index.js\"}}"}}
[debug] [2022-08-10T06:05:17.187Z] [runtime-status] [13808] Functions runtime initialized. {"cwd":"D:\\BigData\\13. Firebase\\FB-BTD\\kickbear\\functions","node_version":"16.16.0"} {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-app"},"extension":{},"message":"[runtime-status] [13808] Functions runtime initialized. {\"cwd\":\"D:\\\\BigData\\\\13. Firebase\\\\FB-BTD\\\\kickbear\\\\functions\",\"node_version\":\"16.16.0\"}"}}
[warn] ! It looks like you're trying to access functions.config().firebase but there is no value there. You can learn more about setting up config here: https://firebase.google.com/docs/functions/local-emulator {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-app"},"extension":{},"message":"It looks like you're trying to access functions.config().firebase but there is no value there. You can learn more about setting up config here: https://firebase.google.com/docs/functions/local-emulator"}}
[debug] [2022-08-10T06:05:18.528Z] [runtime-status] [13808] initializeApp(DEFAULT) {"storageBucket":"prj-out22-20180718.appspot.com","databaseURL":"http://localhost:9000/?ns=prj-out22-20180718","projectId":"prj-out22-20180718"} {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-app"},"extension":{},"message":"[runtime-status] [13808] initializeApp(DEFAULT) {\"storageBucket\":\"prj-out22-20180718.appspot.com\",\"databaseURL\":\"http://localhost:9000/?ns=prj-out22-20180718\",\"projectId\":\"prj-out22-20180718\"}"}}
[debug] [2022-08-10T06:05:18.812Z] [runtime-status] [13808] Beginning invocation function app! {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-app"},"extension":{},"message":"[runtime-status] [13808] Beginning invocation function app!"}}
[info] i functions: Beginning execution of "app" {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-app"},"extension":{},"message":"Beginning execution of \"app\""}}
[debug] [2022-08-10T06:05:18.814Z] [runtime-status] [13808] Running app in signature http {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-app"},"extension":{},"message":"[runtime-status] [13808] Running app in signature http"}}
[debug] [2022-08-10T06:05:18.834Z] [runtime-status] [13808] Listening to port: \\?\pipe\fire_emu_c5878ff69629ce9a {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-app"},"extension":{},"message":"[runtime-status] [13808] Listening to port: \\\\?\\pipe\\fire_emu_c5878ff69629ce9a"}}
[debug] [2022-08-10T06:05:18.950Z] [functions] Runtime ready! Sending request! {"metadata":{"emulator":{"name":"functions"},"message":"[functions] Runtime ready! Sending request!"}}
[debug] [2022-08-10T06:05:18.951Z] [functions] Got req.url=/prj-out22-20180718/us-central1/app/, mapping to path=/ {"metadata":{"emulator":{"name":"functions"},"message":"[functions] Got req.url=/prj-out22-20180718/us-central1/app/, mapping to path=/"}}
[debug] [2022-08-10T06:05:18.957Z] [runtime-status] [13808] Ephemeral server handling GET request {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-app"},"extension":{},"message":"[runtime-status] [13808] Ephemeral server handling GET request"}}
[debug] [2022-08-10T06:05:18.963Z] [runtime-status] [13808] Ephemeral server survived. {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-app"},"extension":{},"message":"[runtime-status] [13808] Ephemeral server survived."}}
[debug] [2022-08-10T06:05:19.597Z] <<< [apiv2][status] GET http://localhost:5001/prj-out22-20180718/us-central1/app/ 200
[debug] [2022-08-10T06:05:19.597Z] <<< [apiv2][body] GET http://localhost:5001/prj-out22-20180718/us-central1/app/ [stream]
Please advise, if any dependencies need to be upgraded to downgraded.
I was stuck with this for nearly two days. So i did couple of things.
Uninstalled all the NPM Packages which i had installed globally and locally.
Reinstalled Firebase-admin, Firebase-Functions and also other packages which was outdated with #latest, locally in the app folder.
Was not sure if firebase-tools package is to be installed locally or globally as a standard as Google Docs has global keyword in and one of David Easts recent video he has installed it locally. But anyhow reinstalled globally.
Not much actually changed in my code.
Just restarted the computer all worked.
Update : There seem to be a known issue. Downgraded to 11.2.2
I am trying to deploy my angular app to firebase, I have tried all methods to init firebase, select hosting and then deploying my app on firebase from various tutorials. But I always get an error:
I don't know what's wrong .
This is how my firebase-debug.log looks
[debug] [2020-03-26T10:42:00.096Z] ----------------------------------------------------------------------
[debug] [2020-03-26T10:42:00.098Z] Command: C:\Program Files\nodejs\node.exe C:\Users\pulki\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js deploy
[debug] [2020-03-26T10:42:00.098Z] CLI Version: 7.16.1
[debug] [2020-03-26T10:42:00.098Z] Platform: win32
[debug] [2020-03-26T10:42:00.098Z] Node Version: v10.16.3
[debug] [2020-03-26T10:42:00.099Z] Time: Thu Mar 26 2020 16:12:00 GMT+0530 (India Standard Time)
[debug] [2020-03-26T10:42:00.099Z] ----------------------------------------------------------------------
[debug] [2020-03-26T10:42:00.099Z]
[debug] [2020-03-26T10:42:00.105Z] > 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] [2020-03-26T10:42:00.105Z] > authorizing via signed-in user
[debug] [2020-03-26T10:42:00.105Z] [iam] checking project frezzo-pul5 for permissions ["firebase.projects.get","firebasedatabase.instances.update","firebasehosting.sites.update"]
[debug] [2020-03-26T10:42:00.108Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[debug] [2020-03-26T10:42:00.108Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
<request body omitted>
[debug] [2020-03-26T10:42:00.624Z] <<< HTTP RESPONSE 200
[debug] [2020-03-26T10:42:00.630Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/frezzo-pul5:testIamPermissions
[debug] [2020-03-26T10:42:02.770Z] <<< HTTP RESPONSE 200
[debug] [2020-03-26T10:42:02.772Z] >>> HTTP REQUEST GET https://firebase.googleapis.com/v1beta1/projects/frezzo-pul5
[debug] [2020-03-26T10:42:03.760Z] <<< HTTP RESPONSE 200
[info]
[info] === Deploying to 'frezzo-pul5'...
[info]
[info] i deploying database, hosting
[info] i database: checking rules syntax...
[debug] [2020-03-26T10:42:03.764Z] >>> HTTP REQUEST PUT https://frezzo-pul5.firebaseio.com/.settings/rules.json?dryRun=true
{
"rules": {
".read": true,
".write": true
}
}
[debug] [2020-03-26T10:42:06.330Z] <<< HTTP RESPONSE 404
[debug] [2020-03-26T10:42:06.330Z] <<< HTTP RESPONSE BODY {
"error" : "Firebase error. Please ensure that you spelled the name of your Firebase correctly"
}
[error]
[error] Error: Unexpected error while deploying database rules.
I have set no security on my firebase Database. Is that an issue ?
I have also tried firebase serve to locally check my app and that just works fine.
Thanks for you help !!
If you deactivated one or more of the functions since activation, when running
$ firebase init for the first time, it will mess up things when trying to deploy.
For example, sometimes realtime databases get automatically deactivated if you are not using them, just try to re-enable them to be able to deploy. Otherwise, you'll need to re-run the init with different options, and remove unused files for it to work.
Try initiating the firebase database from console. In most cases, the firebase database is not set on the cloud, so the console utility is not able to upload the db rules, and hence gives this error. Try using the following commands:
firebase init database
following updates will follow on the console:
=== Database Setup
i database: ensuring required API firebasedatabase.googleapis.com is enabled...
⚠ database: missing required API firebasedatabase.googleapis.com. Enabling now...
✔ database: required API firebasedatabase.googleapis.com is enabled
? It seems like you haven’t initialized Realtime Database in your project yet. Do you want to set it up? Yes
? Please choose the location for your default Realtime Database instance: us-central1
✔ Creating your default Realtime Database instance: ********-default-rtdb
With this, your database deployment error might get resolved.
I have several unit tests to test different Repositories of collections in Firestore.
If I run the entire unit tests, the first two of the Firestore unit tests run fine without timeout, but the subsequent ones get timeout all the time.
If I run the failing ones each on its own (i.e. using describe.only()) then it runs just fine without getting any timeout.
In the firestore-debug.log, I see the following entries:
----------------------------------------------------------------------
[debug] [2019-12-25T04:29:17.643Z] Command: /usr/local/bin/node /usr/local/bin/firebase emulators:exec mocha --recursive
[debug] [2019-12-25T04:29:17.643Z] CLI Version: 7.9.0
[debug] [2019-12-25T04:29:17.643Z] Platform: darwin
[debug] [2019-12-25T04:29:17.643Z] Node Version: v12.13.1
[debug] [2019-12-25T04:29:17.647Z]
----------------------------------------------------------------------
[debug] [2019-12-25T04:29:17.647Z]
[debug] [2019-12-25T04:29:17.658Z] > 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] [2019-12-25T04:29:17.658Z] > authorizing via signed-in user
[info] i emulators: Starting emulators: functions, firestore, hosting
[warn] ⚠ Your requested "node" version "8" doesn't match your global version "12"
[info] ✔ functions: Emulator started at http://localhost:5001
[info] i firestore: Serving ALL traffic (including WebChannel) on http://localhost:5002
[warn] ⚠ firestore: Support for WebChannel on a separate port (5003) is DEPRECATED and will go away soon. Please use port above instead.
[debug] [2019-12-25T04:29:17.994Z] Ignoring unsupported arg: projectId
[debug] [2019-12-25T04:29:17.994Z] Ignoring unsupported arg: auto_download
[debug] [2019-12-25T04:29:17.994Z] Starting emulator firestore with command {"binary":"java","args":["-Duser.language=en","-jar","/Users/yoda/.cache/firebase/emulators/cloud-firestore-emulator-v1.10.2.jar","--host","localhost","--port",5002,"--rules","/Users/yoda/Projects/p0rnhub/service/firestore.rules","--functions_emulator","localhost:5001","--webchannel_port",5003],"optionalArgs":["port","webchannel_port","host","rules","functions_emulator"],"joinArgs":false}
[info] i firestore: Emulator logging to firestore-debug.log
[debug] [2019-12-25T04:29:19.869Z] API endpoint: http://
[debug] [2019-12-25T04:29:19.869Z] localhost:5002
If you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:
export FIRESTORE_EMULATOR_HOST=localhost:
[debug] [2019-12-25T04:29:19.869Z] 5002
Dev App Server is now running.
[info] ✔ firestore: Emulator started at http://localhost:5002
[info] i firestore: For testing set FIRESTORE_EMULATOR_HOST=localhost:5002
[debug] [2019-12-25T04:29:20.035Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[debug] [2019-12-25T04:29:20.036Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
<request body omitted>
[debug] [2019-12-25T04:29:20.185Z] <<< HTTP RESPONSE 200
[debug] [2019-12-25T04:29:20.200Z] >>> HTTP REQUEST GET https://firebase.googleapis.com/v1beta1/projects/p0rnhub/webApps/-/config
[debug] [2019-12-25T04:29:21.157Z] <<< HTTP RESPONSE 200
[info] i hosting: Serving hosting files from: public
[info] ✔ hosting: Local server: http://localhost:5000
[info] ✔ hosting: Emulator started at http://localhost:5000
[info] i functions: Watching "/Users/yoda/Projects/p0rnhub/service/functions" for Cloud Functions...
[debug] [2019-12-25T04:29:21.435Z] [worker-~diagnostic~-8c5a2752-d4c3-408b-b55c-df1aba3f5987]: Assigning socketPath: /var/folders/h5/x3f6g38d1n5_wd1mrk8_ckm00000gn/T/fire_emu_67092.sock
[debug] [2019-12-25T04:29:21.435Z] [worker-~diagnostic~-8c5a2752-d4c3-408b-b55c-df1aba3f5987]: BUSY
[debug] [2019-12-25T04:29:21.804Z] [runtime-status] [67092] Functions runtime initialized. {"cwd":"/Users/yoda/Projects/p0rnhub/service/functions","node_version":"12.13.1"}
[debug] [2019-12-25T04:29:21.806Z] [runtime-status] [67092] Disabled runtime features: undefined
[debug] [2019-12-25T04:29:21.810Z] [runtime-status] [67092] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.8.0","resolution":"/Users/yoda/Projects/p0rnhub/service/functions/node_modules/firebase-admin/lib/index.js"}
[debug] [2019-12-25T04:29:21.812Z] [runtime-status] [67092] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.3.0","resolution":"/Users/yoda/Projects/p0rnhub/service/functions/node_modules/firebase-functions/lib/index.js"}
[debug] [2019-12-25T04:29:22.124Z] [runtime-status] [67092] Found google-gax at /Users/yoda/Projects/p0rnhub/service/functions/node_modules/google-gax/build/src/index.js
[debug] [2019-12-25T04:29:22.124Z] [runtime-status] [67092] Outgoing network have been stubbed. [{"name":"http","status":"mocked"},{"name":"http","status":"mocked"},{"name":"https","status":"mocked"},{"name":"https","status":"mocked"},{"name":"net","status":"mocked"},{"name":"google-gax","status":"mocked"}]
[debug] [2019-12-25T04:29:22.178Z] [runtime-status] [67092] Checked functions.config() {"config":{}}
[debug] [2019-12-25T04:29:22.179Z] [runtime-status] [67092] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.3.0","resolution":"/Users/yoda/Projects/p0rnhub/service/functions/node_modules/firebase-functions/lib/index.js"}
[debug] [2019-12-25T04:29:22.180Z] [runtime-status] [67092] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.8.0","resolution":"/Users/yoda/Projects/p0rnhub/service/functions/node_modules/firebase-admin/lib/index.js"}
[debug] [2019-12-25T04:29:22.180Z] [runtime-status] [67092] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.3.0","resolution":"/Users/yoda/Projects/p0rnhub/service/functions/node_modules/firebase-functions/lib/index.js"}
[debug] [2019-12-25T04:29:22.232Z] [runtime-status] [67092] firebase-admin has been stubbed. {"adminResolution":{"declared":true,"installed":true,"version":"8.8.0","resolution":"/Users/yoda/Projects/p0rnhub/service/functions/node_modules/firebase-admin/lib/index.js"}}
[info] ✔ functions[auth]: http function initialized (http://localhost:5001/p0rnhub/us-central1/auth).
[info] ✔ functions[token]: http function initialized (http://localhost:5001/p0rnhub/us-central1/token).
[info] ✔ functions[login]: http function initialized (http://localhost:5001/p0rnhub/us-central1/login).
[info] ✔ functions[start]: http function initialized (http://localhost:5001/p0rnhub/us-central1/start).
[info] ✔ functions[stop]: http function initialized (http://localhost:5001/p0rnhub/us-central1/stop).
[info] ✔ functions[list]: http function initialized (http://localhost:5001/p0rnhub/us-central1/list).
[info] i Running script: mocha --recursive
[debug] [2019-12-25T04:29:22.252Z] Running mocha --recursive with environment {"npm_config_save_dev":"","npm_config_legacy_bundling":"","npm_config_dry_run":"","npm_config_viewer":"man","npm_config_only":"","npm_config_commit_hooks":"true","npm_config_browser":"","npm_config_also":"","npm_config_sign_git_commit":"","npm_config_rollback":"true","TERM_PROGRAM":"Apple_Terminal","NODE":"/usr/local/bin/node","npm_config_usage":"","npm_config_audit":"true","INIT_CWD":"/Users/yoda/Projects/p0rnhub/service/functions","npm_package_devDependencies_sinon":"^7.5.0","npm_config_globalignorefile":"/usr/local/etc/npmignore","npm_package_devDependencies_mocha":"^6.2.2","TERM":"xterm-256color","SHELL":"/bin/zsh","npm_config_shell":"/bin/zsh","npm_config_maxsockets":"50","npm_config_init_author_url":"","npm_config_shrinkwrap":"true","npm_config_parseable":"","npm_config_metrics_registry":"https://registry.npmjs.org/","TMPDIR":"/var/folders/h5/x3f6g38d1n5_wd1mrk8_ckm00000gn/T/","npm_config_timing":"","npm_config_init_license":"ISC","npm_config_if_present":"","TERM_PROGRAM_VERSION":"433","npm_config_sign_git_tag":"","npm_config_init_author_email":"","npm_config_cache_max":"Infinity","npm_package_dependencies_uuid":"^3.3.3","npm_config_preid":"","npm_config_long":"","npm_config_local_address":"","npm_config_git_tag_version":"true","npm_config_cert":"","TERM_SESSION_ID":"AD305AB7-88B6-4E8E-9681-273EEB25429A","npm_config_registry":"https://registry.npmjs.org/","npm_config_noproxy":"","npm_config_fetch_retries":"2","npm_package_private":"true","npm_config_versions":"","npm_config_message":"%s","npm_config_key":"","npm_package_description":"Cloud Functions for Firebase","USER":"yoda","npm_package_scripts_deploy":"firebase deploy --only functions","npm_config_globalconfig":"/usr/local/etc/npmrc","npm_package_scripts_shell":"firebase functions:shell","npm_config_prefer_online":"","npm_config_logs_max":"10","npm_config_always_auth":"","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.sLVgtsWI6z/Listeners","__CF_USER_TEXT_ENCODING":"0x1F5:0x0:0x0","npm_execpath":"/usr/local/lib/node_modules/npm/bin/npm-cli.js","npm_config_global_style":"","npm_config_cache_lock_retries":"10","npm_package_dependencies_firebase_functions":"^3.3.0","npm_config_update_notifier":"true","npm_config_cafile":"","npm_config_heading":"npm","npm_config_audit_level":"low","npm_config_searchlimit":"20","npm_config_read_only":"","npm_config_offline":"","npm_config_fetch_retry_mintimeout":"10000","npm_config_json":"","npm_config_access":"","npm_config_argv":"{\"remain\":[],\"cooked\":[\"test\"],\"original\":[\"test\"]}","PATH":"/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/yoda/Projects/p0rnhub/service/functions/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin","npm_config_allow_same_version":"","npm_config_https_proxy":"","npm_config_engine_strict":"","npm_config_description":"true","_":"/usr/local/bin/firebase","LaunchInstanceID":"486CA774-9DDE-42B4-A90D-EB3553FE7181","npm_config_userconfig":"/Users/yoda/.npmrc","npm_config_init_module":"/Users/yoda/.npm-init.js","npm_config_cidr":"","PWD":"/Users/yoda/Projects/p0rnhub/service/functions","npm_config_user":"","npm_config_node_version":"12.13.1","npm_lifecycle_event":"test","npm_config_save":"true","npm_config_ignore_prepublish":"","npm_config_editor":"vi","npm_config_auth_type":"legacy","npm_package_name":"functions","npm_config_tag":"latest","npm_config_script_shell":"","npm_config_progress":"true","npm_config_global":"","npm_config_before":"","npm_package_scripts_start":"npm run shell","npm_config_searchstaleness":"900","npm_config_optional":"true","npm_config_ham_it_up":"","XPC_FLAGS":"0x0","npm_config_save_prod":"","npm_config_force":"","npm_config_bin_links":"true","npm_config_searchopts":"","npm_package_engines_node":"8","npm_config_node_gyp":"/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js","npm_config_depth":"Infinity","npm_config_sso_poll_frequency":"500","npm_config_rebuild_bundle":"true","npm_package_version":"","XPC_SERVICE_NAME":"0","npm_config_unicode":"true","HOME":"/Users/yoda","SHLVL":"2","npm_config_fetch_retry_maxtimeout":"60000","npm_package_scripts_test":"firebase emulators:exec \"mocha --recursive\"","npm_config_tag_version_prefix":"v","npm_config_strict_ssl":"true","npm_config_sso_type":"oauth","npm_config_scripts_prepend_node_path":"warn-only","npm_config_save_prefix":"^","npm_config_loglevel":"notice","npm_config_ca":"","npm_package_scripts_serve":"firebase serve --only functions","npm_config_save_exact":"","npm_config_group":"20","npm_config_fetch_retry_factor":"10","npm_config_dev":"","npm_package_devDependencies_firebase_functions_test":"^0.1.7","npm_config_version":"","npm_config_prefer_offline":"","npm_config_cache_lock_stale":"60000","npm_package_devDependencies__firebase_testing":"^0.12.3","npm_config_otp":"","npm_config_cache_min":"10","npm_config_searchexclude":"","npm_config_cache":"/Users/yoda/.npm","npm_package_dependencies_base64url":"^3.0.1","npm_package_scripts_logs":"firebase functions:log","LOGNAME":"yoda","npm_lifecycle_script":"firebase emulators:exec \"mocha --recursive\"","npm_config_color":"true","npm_config_proxy":"","npm_config_package_lock":"true","npm_package_dependencies_build_url":"^1.3.3","LC_CTYPE":"UTF-8","npm_config_package_lock_only":"","npm_config_fund":"true","npm_config_save_optional":"","npm_config_ignore_scripts":"","npm_config_user_agent":"npm/6.13.4 node/v12.13.1 darwin x64","npm_config_cache_lock_wait":"10000","npm_config_production":"","npm_config_send_metrics":"","npm_config_save_bundle":"","npm_config_umask":"0022","npm_config_node_options":"","npm_config_init_version":"1.0.0","npm_config_init_author_name":"","npm_config_git":"git","npm_config_scope":"","SECURITYSESSIONID":"186a8","npm_config_unsafe_perm":"true","npm_config_tmp":"/var/folders/h5/x3f6g38d1n5_wd1mrk8_ckm00000gn/T","npm_config_onload_script":"","npm_package_dependencies_firebase_admin":"^8.8.0","npm_node_execpath":"/usr/local/bin/node","npm_config_prefix":"/usr/local","npm_config_link":"","npm_config_format_package_lock":"true","FIRESTORE_EMULATOR_HOST":"localhost:5002","FIREBASE_FIRESTORE_EMULATOR_ADDRESS":"localhost:5002"}
[debug] [2019-12-25T04:29:22.263Z] [worker-~diagnostic~-8c5a2752-d4c3-408b-b55c-df1aba3f5987]: exited
[debug] [2019-12-25T04:29:22.263Z] [worker-~diagnostic~-8c5a2752-d4c3-408b-b55c-df1aba3f5987]: FINISHED
[debug] [2019-12-25T04:29:23.385Z] Dec 25, 2019 11:29:23 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected HTTP/2 connection.
[debug] [2019-12-25T04:29:24.429Z] Dec 25, 2019 11:29:24 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected HTTP/2 connection.
[warn] ⚠ Script exited unsuccessfully (code 4)
[info] i Shutting down emulators.
[info] i Stopping functions emulator
[info] i Stopping firestore emulator
[debug] [2019-12-25T04:29:34.479Z] *** shutting down gRPC server since JVM is shutting down
[debug] [2019-12-25T04:29:34.482Z] *** server shut down
[info] i Stopping hosting emulator
[error]
[error] Error: Script "mocha --recursive" exited with code 4
Here's how I setup each Firestore unit test:
const assert = require("assert")
const firebase = require("#firebase/testing")
const { SampleRepository } = require("./SampleRepository")
const projectId = "a-project-id"
const app = firebase.initializeAdminApp({ projectId })
describe("SampleRepository", () => {
var db
var repository
before(async () => {
db = app.firestore()
repository = new SampleRepository(db)
})
afterEach(async () => {
await firebase.clearFirestoreData({ projectId })
})
after(async () => {
await db.terminate()
})
describe("firstMethod", () => {
it("use case 1", async () => {
// Do some testing here.
})
it("use case 2", async () => {
// Do some testing here.
})
})
describe("secondMethod", () => {
it("use case 1", async () => {
// Do some testing here.
})
})
})
I setup the npm test command to invoke this: firebase emulators:exec \"mocha --recursive\".
At this point, I am pretty clueless what causes this but I suspect it's a problem in the Firestore emulator or something? And I don't know what code 4 means in: Script exited unsuccessfully (code 4).
Any help is appreciated.
UPDATE 1: Now I know what the code 4 means. It means that I have 4 failing tests.
What i have done,
I ran firebase init in my html/css/js landing page project.
Setup for hosting only, but when i run my firebase deploy --only hosting:sitename I get an unexpected error. Don't know where to start looking.
All my tools are uptodate , firebase tools, node ect...
This is the Firebase JSON file
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
And here is the DEBUG LOG
[debug]
[debug] [2019-02-27T06:34:00.434Z] > 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] [2019-02-27T06:34:00.435Z] > authorizing via signed-in user
[debug] [2019-02-27T06:34:00.435Z] [iam] checking project fakturo-89fe7 for permissions ["firebase.projects.get","firebasehosting.sites.update"]
[debug] [2019-02-27T06:34:00.439Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/fakturo-89fe7:testIamPermissions
[debug] [2019-02-27T06:34:01.631Z] <<< HTTP RESPONSE 200
[debug] [2019-02-27T06:34:01.636Z] >>> HTTP REQUEST GET https://firebase.googleapis.com/v1beta1/projects/fakturo-89fe7
[debug] [2019-02-27T06:34:02.042Z] <<< HTTP RESPONSE 200
[info]
[info] === Deploying to 'fakturo-89fe7'...
[info]
[info] i deploying hosting
[info]
[info] ✔ Deploy complete!
[info]
[info] Project Console: https://console.firebase.google.com/project/fakturo-89fe7/overview
[debug] [2019-02-27T06:34:02.057Z] TypeError: Cannot read property 'deploys' of undefined
at /usr/local/lib/node_modules/firebase-tools/lib/deploy/index.js:88:36
at process._tickCallback (internal/process/next_tick.js:68:7)
[error]
[error] Error: An unexpected error has occurred.
My hosting is configured for multiple sites, I got the same issue, fixed it by adding
"site": "firebase-hosting-site",
in
{
"hosting": {
"site": "firebase-hosting-site",
"public": "build/web",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}