Cloud Functions Unexpected Error
Environment info
firebase-tools: 11.0.1
NodeJs: 16.13.2
Platform: Windows 10
Test case
Emulator crashes after an unexpected error when I change a typescript file. The issue started after I have just updated firebase tools from major version 10 to 11. I have also updated functions and admin to the latest versions.
Steps to reproduce
1.Run Emulators 2. Update Tpsescript file
[REQUIRED] Expected behavior
Emulators should continue to function in the background without errors
Actual behavior
An unexpected error occurs an emulators crash.
Below is the debug log with identifiers and absolute paths omitted
[debug] [2022-05-30T12:28:21.422Z] ----------------------------------------------------------------------
[debug] [2022-05-30T12:28:21.424Z] Command: ..\Program Files\nodejs\node.exe ..\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js emulators:start --only hosting,functions --import=firebase_import --export-on-exit --project x
[debug] [2022-05-30T12:28:21.424Z] CLI Version: 11.0.1
[debug] [2022-05-30T12:28:21.424Z] Platform: win32
[debug] [2022-05-30T12:28:21.425Z] Node Version: v16.13.2
[debug] [2022-05-30T12:28:21.426Z] Time: Mon May 30 2022 14:28:21 GMT+0200 (Eastern European Standard Time)
[debug] [2022-05-30T12:28:21.426Z] ----------------------------------------------------------------------
[debug]
[debug] [2022-05-30T12:28:21.487Z] Object ".hosting.headers[0]" in "firebase.json" has unknown property: {"additionalProperty":"source"}
[debug] [2022-05-30T12:28:21.487Z] Field ".hosting.headers[0].headers[2].value" in "firebase.json" is possibly invalid: should be string
[debug] [2022-05-30T12:28:21.488Z] Object ".hosting.headers[0]" in "firebase.json" has unknown property: {"additionalProperty":"source"}
[debug] [2022-05-30T12:28:21.488Z] Field ".hosting.headers[0]" in "firebase.json" is possibly invalid: should match some schema in anyOf
[debug] [2022-05-30T12:28:21.488Z] Field ".hosting" in "firebase.json" is possibly invalid: should be array
[debug] [2022-05-30T12:28:21.488Z] Field ".hosting" in "firebase.json" is possibly invalid: should match some schema in anyOf
[debug] [2022-05-30T12:28:21.494Z] > 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-05-30T12:28:21.495Z] > authorizing via signed-in user ([email protected])
[info] i emulators: Starting emulators: functions, hosting {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: functions, hosting"}}
[debug] [2022-05-30T12:28:21.518Z] [hub] writing locator at ..\AppData\Local\Temp\hub-x.json
[warn] ! functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: auth, firestore, 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[1mauth, firestore, database, pubsub, storage\u001b[22m"}}
[info] + functions: Using node@16 from host. {"metadata":{"emulator":{"name":"functions"},"message":"Using node@16 from host."}}
[debug] [2022-05-30T12:28:21.555Z] defaultcredentials: writing to file ..\firebase\x_application_default_credentials.json
[debug] [2022-05-30T12:28:21.556Z] Setting GAC to ..\firebase\x_application_default_credentials.json {"metadata":{"emulator":{"name":"functions"},"message":"Setting GAC to ..\\firebase\\x_application_default_credentials.json"}}
[debug] [2022-05-30T12:28:21.558Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/x/adminSdkConfig [none]
[debug] [2022-05-30T12:28:22.156Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/x/adminSdkConfig 200
[debug] [2022-05-30T12:28:22.156Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/x/adminSdkConfig {"projectId":"x","storageBucket":"x.appspot.com","locationId":"europe-west3"}
[debug] [2022-05-30T12:28:22.175Z] >>> [apiv2][query] GET https://firebasehosting.googleapis.com/v1beta1/projects/x/sites
[debug] [2022-05-30T12:28:23.450Z] <<< [apiv2][status] GET https://firebasehosting.googleapis.com/v1beta1/projects/x/sites 200
[debug] [2022-05-30T12:28:23.450Z] <<< [apiv2][body] GET https://firebasehosting.googleapis.com/v1beta1/projects/x/sites {"sites":[{"name":"projects/x/sites/x","defaultUrl":"https://x.web.app","appId":"1:711587213104:web:8b41b4f316c25ff18da2f5","type":"DEFAULT_SITE"}]}
[debug] [2022-05-30T12:28:23.451Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/x/webApps/1:711587213104:web:8b41b4f316c25ff18da2f5/config [none]
[debug] [2022-05-30T12:28:24.801Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/x/webApps/1:711587213104:web:8b41b4f316c25ff18da2f5/config 200
[debug] [2022-05-30T12:28:24.801Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/x/webApps/1:711587213104:web:8b41b4f316c25ff18da2f5/config {"projectId":"x","appId":"1:711587213104:web:8b41b4f316c25ff18da2f5","storageBucket":"x.appspot.com","locationId":"europe-west3","apiKey":"AIzaSyAlwm_-qQuM1v68_Of-FwSHRfk5LMmLFxc","authDomain":"x.firebaseapp.com","messagingSenderId":"711587213104"}
[info] i hosting: Serving hosting files from: public {"metadata":{"emulator":{"name":"hosting"},"message":"Serving hosting files from: \u001b[1mpublic\u001b[22m"}}
[info] + hosting: Local server: http://localhost:5000 {"metadata":{"emulator":{"name":"hosting"},"message":"Local server: \u001b[4m\u001b[1mhttp://localhost:5000\u001b[22m\u001b[24m"}}
[debug] [2022-05-30T12:28:24.837Z] Ignoring unsupported arg: auto_download {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: auto_download"}}
[debug] [2022-05-30T12:28:24.837Z] Ignoring unsupported arg: port {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: port"}}
[debug] [2022-05-30T12:28:24.837Z] Starting Emulator UI with command {"binary":"node","args":["--dns-result-order=ipv4first","..\\.cache\\firebase\\emulators\\ui-v1.7.0\\server.bundle.js"],"optionalArgs":[],"joinArgs":false} {"metadata":{"emulator":{"name":"ui"},"message":"Starting Emulator UI with command {\"binary\":\"node\",\"args\":[\"--dns-result-order=ipv4first\",\"..\\\\.cache\\\\firebase\\\\emulators\\\\ui-v1.7.0\\\\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] [2022-05-30T12:28:24.961Z] Web / API server started at localhost:4000
{"metadata":{"emulator":{"name":"ui"},"message":"Web / API server started at localhost:4000\n"}}
[info] i functions: Watching "..\functions" for Cloud Functions... {"metadata":{"emulator":{"name":"functions"},"message":"Watching \"..\\functions\" for Cloud Functions..."}}
[debug] [2022-05-30T12:28:25.132Z] Validating nodejs source
[debug] [2022-05-30T12:28:28.364Z] > [functions] package.json contents: {
"name": "functions",
"scripts": {
"lint": "eslint --ext .js,.ts .",
"build": "tsc",
"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": {
"axios": "^0.24.0",
"cookie-parser": "^1.4.6",
"date-fns": "^2.28.0",
"date-fns-tz": "^1.2.2",
"debug": "^4.3.3",
"express": "^4.17.2",
"express-validator": "^6.14.0",
"firebase": "^9.6.2",
"firebase-admin": "^10.2.0",
"firebase-functions": "^3.21.2",
"node-forge": "^1.2.1",
"uuid": "^8.3.2"
},
"devDependencies": {
"@types/cookie-parser": "^1.4.2",
"@typescript-eslint/eslint-plugin": "^5.9.1",
"@typescript-eslint/parser": "^5.9.1",
"eslint": "^8.8.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-import": "^2.22.0",
"firebase-functions-test": "^0.3.3",
"typescript": "^4.5.4"
},
"private": true
}
[debug] [2022-05-30T12:28:28.365Z] Building nodejs source
[debug] [2022-05-30T12:28:28.365Z] Analyzing nodejs backend spec
[debug] [2022-05-30T12:28:28.370Z] Could not find functions.yaml. Must use http discovery
[info] i emulators: Shutting down emulators. {"metadata":{"emulator":{"name":"hub"},"message":"Shutting down emulators."}}
[info] i ui: Stopping Emulator UI {"metadata":{"emulator":{"name":"ui"},"message":"Stopping Emulator UI"}}
[warn] ! Emulator UI has exited upon receiving signal: SIGINT
[info] i functions: Stopping Functions Emulator {"metadata":{"emulator":{"name":"functions"},"message":"Stopping Functions Emulator"}}
[info] i hosting: Stopping Hosting Emulator {"metadata":{"emulator":{"name":"hosting"},"message":"Stopping Hosting Emulator"}}
[info] i hub: Stopping emulator hub {"metadata":{"emulator":{"name":"hub"},"message":"Stopping emulator hub"}}
[info] i logging: Stopping Logging Emulator {"metadata":{"emulator":{"name":"logging"},"message":"Stopping Logging Emulator"}}
[debug] [2022-05-30T12:28:28.558Z] FetchError: request to http://localhost:9005/__/quitquitquit failed, reason: connect ECONNREFUSED 127.0.0.1:9005
at ClientRequest.<anonymous> (..\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\node-fetch\lib\index.js:1491:11)
at ClientRequest.emit (node:events:390:28)
at ClientRequest.emit (node:domain:475:12)
at Socket.socketErrorListener (node:_http_client:447:9)
at Socket.emit (node:events:390:28)
at Socket.emit (node:domain:475:12)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
[error]
[error] Error: An unexpected error has occurred.
[debug] [2022-05-30T12:28:28.608Z] Serving at port 9005
This issue does not seem to follow the issue template. Make sure you provide all the required information.
This issue does not seem to follow the issue template. Make sure you provide all the required information.
Updated.
we had the same error on firebase tools 11.4.1
Sorry that you've run into this issue. We should have fixed this in #4826 and released in 11.5.0. Can you update to the latest version and retry? Thanks!
Hey @Sharkawy. 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!
Since there haven't been any recent updates here, I am going to close this issue.
@Sharkawy 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.