nuxt: Firebase tools 10.9.x deploy failed
Environment
Nuxt v3.0.0-rc.3 Node Version: v16.15.0 Firebase Tools 10.9.2(or 10.9.0 -) Windows 11 wsl or Docker image andreysenov/firebase-tools@latest
Reproduction
npx nuxi init nuxt-app && Nitro Firebase
Describe the bug
Firebase tools version 10.9.x firebase deploy or firebase emulators:start failed.
Successful deployment with version 10.7.0,10.8.0
Additional context
No response
Logs
$ firebase emulators:start
i emulators: Starting emulators: functions, hosting
⚠ functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: auth, firestore, database, pubsub, storage
✔ functions: Using node@16 from host.
i hosting[<your_project_id>]: Serving hosting files from: .output/public
✔ hosting[<your_project_id>]: Local server: http://127.0.0.1:5000
⚠ ui: Emulator UI unable to start on port 4000, starting on 4009 instead.
i ui: downloading ui-v1.7.0.zip...
Progress: ============================================================================================> (100% of 5MB
i ui: Removing outdated emulator files: ui-v1.6.6
i ui: Removing outdated emulator files: ui-v1.6.6.zip
i ui: Emulator UI logging to ui-debug.log
i functions: Watching "/home/.../nuxt-app/.output/server" for Cloud Functions...
Error: An unexpected error has occurred.
debug.log
$ firebase emulators:start --debug
[2022-05-12T18:59:16.641Z] > 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"]
[2022-05-12T18:59:16.642Z] > authorizing via FIREBASE_TOKEN environment variable
i emulators: Starting emulators: functions, hosting {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: functions, hosting"}}
⚠ emulators: It seems that you are running multiple instances of the emulator suite for project project_xxx. This may result in unexpected behavior.
[2022-05-12T18:59:16.666Z] [hub] writing locator at /tmp/hub-project_xxx.json
⚠ 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"}}
✔ functions: Using node@16 from host. {"metadata":{"emulator":{"name":"functions"},"message":"Using node@16 from host."}}
[2022-05-12T18:59:16.683Z] defaultcredentials: writing to file /home/xxx/.config/firebase/xxx_application_default_credentials.json
[2022-05-12T18:59:16.685Z] Setting GAC to /home/xxx/.config/firebase/xxx_application_default_credentials.json {"metadata":{"emulator":{"name":"functions"},"message":"Setting GAC to /home/xxx/.config/firebase/xxx_application_default_credentials.json"}}
[2022-05-12T18:59:16.686Z] > refreshing access token with scopes: []
[2022-05-12T18:59:16.687Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
<request body omitted>
[2022-05-12T18:59:16.840Z] <<< HTTP RESPONSE 200 {"pragma":"no-cache","date":"Thu, 12 May 2022 18:59:16 GMT","expires":"Mon, 01 Jan 1990 00:00:00 GMT","cache-control":"no-cache, no-store, max-age=0, must-revalidate","content-type":"application/json; charset=utf-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","server":"scaffolding on HTTPServer2","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[2022-05-12T18:59:16.842Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/project_xxx/adminSdkConfig [none]
[2022-05-12T18:59:17.193Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/project_xxx/adminSdkConfig 200
[2022-05-12T18:59:17.193Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/project_xxx/adminSdkConfig {"projectId":"project_xxx","databaseURL":"https://project_xxx.firebaseio.com","storageBucket":"project_xxx.appspot.com","locationId":"us-central"}
[2022-05-12T18:59:17.204Z] >>> [apiv2][query] GET https://firebasehosting.googleapis.com/v1beta1/projects/project_xxx/sites
[2022-05-12T18:59:18.161Z] <<< [apiv2][status] GET https://firebasehosting.googleapis.com/v1beta1/projects/project_xxx/sites 200
[2022-05-12T18:59:18.161Z] <<< [apiv2][body] GET https://firebasehosting.googleapis.com/v1beta1/projects/project_xxx/sites {"sites":[{"name":"projects/project_xxx/sites/qi-tgh","defaultUrl":"https://qi-tgh.web.app","type":"USER_SITE"},{"name":"projects/project_xxx/sites/project_xxx","defaultUrl":"https://project_xxx.web.app","type":"DEFAULT_SITE"}]}
[2022-05-12T18:59:18.161Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/project_xxx/webApps/-/config [none]
[2022-05-12T18:59:18.828Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/project_xxx/webApps/-/config 200
[2022-05-12T18:59:18.828Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/project_xxx/webApps/-/config {"projectId":"project_xxx","databaseURL":"https://project_xxx.firebaseio.com","storageBucket":"project_xxx.appspot.com","locationId":"us-central","apiKey":"**********","authDomain":"project_xxx.firebaseapp.com","messagingSenderId":"527297563412"}
i hosting[<your_project_id>]: Serving hosting files from: .output/public {"metadata":{"emulator":{"name":"hosting"},"message":"Serving hosting files from: \u001b[1m.output/public\u001b[22m"}}
✔ hosting[<your_project_id>]: 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"}}
⚠ 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."}}
[2022-05-12T18:59:18.853Z] Ignoring unsupported arg: auto_download {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: auto_download"}}
[2022-05-12T18:59:18.854Z] Ignoring unsupported arg: port {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: port"}}
[2022-05-12T18:59:18.854Z] Starting Emulator UI with command {"binary":"node","args":["/home/xxx/.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\":[\"/home/xxx/.cache/firebase/emulators/ui-v1.7.0/server.bundle.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"}}
[2022-05-12T18:59:18.938Z] Web / API server started at 127.0.0.1:4010
{"metadata":{"emulator":{"name":"ui"},"message":"Web / API server started at 127.0.0.1:4010\n"}}
i functions: Watching "/home/xxx/IdeaProjects/nuxt-app/.output/server" for Cloud Functions... {"metadata":{"emulator":{"name":"functions"},"message":"Watching \"/home/xxx/IdeaProjects/nuxt-app/.output/server\" for Cloud Functions..."}}
[2022-05-12T18:59:19.121Z] Validating nodejs source
[2022-05-12T18:59:19.974Z] > [functions] package.json contents: {
"private": true,
"type": "module",
"main": "./index.mjs",
"dependencies": {
"firebase-functions-test": "latest",
"firebase-admin": "10.2.0",
"firebase-functions": "3.21.1",
"abort-controller": "3.0.0",
"agent-base": "6.0.2",
"arrify": "2.0.1",
"async-retry": "1.3.3",
"base64-js": "1.5.1",
"bignumber.js": "9.0.2",
"buffer-from": "1.1.2",
"buffer-equal-constant-time": "1.0.1",
"compressible": "2.0.18",
"configstore": "5.0.1",
"cookie-es": "0.5.0",
"cors": "2.8.5",
"crypto-random-string": "2.0.0",
"date-and-time": "2.3.1",
"debug": "4.3.4",
"destr": "1.1.1",
"dicer": "0.3.1",
"dot-prop": "5.3.0",
"duplexify": "4.1.2",
"ecdsa-sig-formatter": "1.0.11",
"end-of-stream": "1.4.4",
"ent": "2.2.0",
"event-target-shim": "5.0.1",
"extend": "3.0.2",
"fast-deep-equal": "3.1.3",
"fast-text-encoding": "1.0.3",
"functional-red-black-tree": "1.0.1",
"gaxios": "4.3.3",
"gcp-metadata": "4.3.1",
"get-stream": "6.0.1",
"google-auth-library": "7.14.1",
"google-gax": "2.30.4",
"google-p12-pem": "3.1.4",
"graceful-fs": "4.2.10",
"gtoken": "5.3.2",
"h3": "0.7.8",
"has-flag": "4.0.0",
"hookable": "5.1.1",
"hash-stream-validation": "0.2.4",
"http-proxy-agent": "5.0.0",
"https-proxy-agent": "5.0.1",
"imurmurhash": "0.1.4",
"inherits": "2.0.4",
"is-obj": "2.0.0",
"is-stream": "2.0.1",
"is-stream-ended": "0.1.4",
"jose": "2.0.5",
"is-typedarray": "1.0.0",
"json-bigint": "1.0.0",
"jsonwebtoken": "8.5.1",
"jwa": "2.0.0",
"jwks-rsa": "2.1.2",
"jws": "4.0.0",
"limiter": "1.1.5",
"lodash": "4.17.21",
"lodash.camelcase": "4.3.0",
"lodash.clonedeep": "4.5.0",
"lodash.includes": "4.3.0",
"lodash.isboolean": "3.0.3",
"lodash.isinteger": "4.0.4",
"lodash.isnumber": "3.0.3",
"lodash.isplainobject": "4.0.6",
"lodash.isstring": "4.0.1",
"lodash.once": "4.1.1",
"long": "4.0.0",
"lru-cache": "4.0.2",
"lru-memoizer": "2.1.4",
"make-dir": "3.1.0",
"mime": "3.0.0",
"mime-db": "1.52.0",
"mime-types": "2.1.35",
"ms": "2.1.2",
"node-fetch": "2.6.7",
"node-fetch-native": "0.1.3",
"node-forge": "1.3.1",
"object-assign": "4.1.1",
"object-hash": "3.0.0",
"ohash": "0.1.0",
"ohmyfetch": "0.4.17",
"once": "1.4.0",
"p-limit": "3.1.0",
"proto3-json-serializer": "0.1.8",
"protobufjs": "6.11.2",
"pseudomap": "1.0.2",
"pump": "3.0.0",
"pumpify": "2.0.1",
"radix3": "0.1.2",
"readable-stream": "3.6.0",
"retry-request": "4.2.2",
"retry": "0.13.1",
"safe-buffer": "5.2.1",
"scule": "0.2.1",
"semver": "6.3.0",
"signal-exit": "3.0.7",
"snakeize": "0.1.0",
"source-map": "0.6.1",
"source-map-support": "0.5.21",
"stream-events": "1.0.5",
"stream-shift": "1.0.1",
"streamsearch": "1.1.0",
"string_decoder": "1.3.0",
"stubs": "3.0.0",
"supports-color": "7.2.0",
"teeny-request": "7.2.0",
"tr46": "0.0.3",
"tslib": "2.4.0",
"typedarray-to-buffer": "3.1.5",
"ufo": "0.8.4",
"unenv": "0.5.2",
"unique-string": "2.0.0",
"unstorage": "0.4.1",
"util-deprecate": "1.0.2",
"uuid": "8.3.2",
"vary": "1.1.2",
"webidl-conversions": "3.0.1",
"whatwg-url": "5.0.0",
"wrappy": "1.0.2",
"write-file-atomic": "3.0.3",
"xdg-basedir": "4.0.0",
"yallist": "2.1.2",
"yocto-queue": "0.1.0",
"@firebase/component": "0.5.13",
"@firebase/database-compat": "0.1.8",
"@firebase/util": "1.5.2",
"@firebase/logger": "0.3.2",
"@google-cloud/firestore": "4.15.1",
"@google-cloud/paginator": "3.0.7",
"@google-cloud/projectify": "2.1.1",
"@google-cloud/promisify": "2.0.4",
"@google-cloud/storage": "5.19.4",
"@grpc/grpc-js": "1.6.7",
"@grpc/proto-loader": "0.6.12",
"@panva/asn1.js": "1.0.0",
"@protobufjs/aspromise": "1.1.2",
"@protobufjs/base64": "1.1.2",
"@protobufjs/codegen": "2.0.4",
"@protobufjs/eventemitter": "1.1.0",
"@protobufjs/fetch": "1.1.0",
"@protobufjs/float": "1.0.2",
"@protobufjs/inquire": "1.1.0",
"@protobufjs/path": "1.1.2",
"@protobufjs/pool": "1.1.0",
"@protobufjs/utf8": "1.1.0",
"@tootallnate/once": "2.0.0"
},
"engines": {
"node": "16"
}
}
[2022-05-12T18:59:19.974Z] Building nodejs source
[2022-05-12T18:59:19.975Z] Analyzing nodejs backend spec
[2022-05-12T18:59:19.976Z] Could not find functions.yaml. Must use http discovery
[2022-05-12T18:59:19.984Z] Error: spawn ./node_modules/.bin/firebase-functions ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Error: An unexpected error has occurred.
Having trouble? Try again or contact support with contents of firebase-debug.log
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 10
- Comments: 15 (3 by maintainers)
Same Problem. Workaround: Reinstall node modules from output server folder
Currently, I’ve been using another workaround - till the issue is fixed of cause - by copying the needed files into the
.ouput/server/node_moduleswith:Maybe
nuxishould warn the user (as stated in in this discussion) that one has to use node14 for firebase preset?macOS 12.3.1 same problem.
However, make the following description in package.json.
yarn fb:deploy&yarn fb:startExecution was successful. Confirmed with wsl & macOS@skf-funzt I used fnm for Node Manager. I have firebase-tools installed globally, but not firebase functions.
So the problem seems to be that the
firebase deploycommand can’t find thefirebase-functionsfolder.I was able to simply deploy with
NITRO_PRESET=firebase yarn build && npx firebase deploy.@deka The code is packaged for firebase, which installs dependencies on the server-side prior to enabling the
.output/serverin the cloud instance. At the deploy step of firebase, thepackage.jsonin the.ouput/serverfolder will be used instead of thepkacage.jsonin the project’s root. So, to make it more convenient for firebase, thenode_modulesare all included in the upload. Also all of the local, non-public dependencies.