nitro icon indicating copy to clipboard operation
nitro copied to clipboard

Firebase Deployment Failing for Nuxt 3.0.0-rc.3 Starter Project

Open abhay-agarwal opened this issue 3 years ago • 2 comments

Environment

Tried Node 14,16,18 OS: Mac OS 12.3

Reproduction

Nuxt-App with no changes

Describe the bug

firebase.json

{
  "functions": {
    "source": ".output/server"
  },
  "hosting": {
    "public": ".output/public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  },
  "emulators": {
          "hosting": {
            "port": "8000"
          }
        }
}

Additional context

No response

Logs

i  hosting: Serving hosting files from: .output/public {"metadata":{"emulator":{"name":"hosting"},"message":"Serving hosting files from: \u001b[1m.output/public\u001b[22m"}}
✔  hosting: Local server: http://localhost:8000 {"metadata":{"emulator":{"name":"hosting"},"message":"Local server: \u001b[4m\u001b[1mhttp://localhost:8000\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-13T06:13:16.986Z] Ignoring unsupported arg: auto_download {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: auto_download"}}
[2022-05-13T06:13:16.986Z] Ignoring unsupported arg: port {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: port"}}
[2022-05-13T06:13:16.986Z] Starting Emulator UI with command {"binary":"node","args":["/Users/abhay/.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\":[\"/Users/abhay/.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-13T06:13:17.086Z] Web / API server started at localhost:4010
 {"metadata":{"emulator":{"name":"ui"},"message":"Web / API server started at localhost:4010\n"}}
i  functions: Watching "/Users/abhay/workspace/nuxt-app-firebase/.output/server" for Cloud Functions... {"metadata":{"emulator":{"name":"functions"},"message":"Watching \"/Users/abhay/workspace/nuxt-app-firebase/.output/server\" for Cloud Functions..."}}
[2022-05-13T06:13:17.256Z] Validating nodejs source
[2022-05-13T06:13:18.678Z] > [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-equal-constant-time": "1.0.1",
    "buffer-from": "1.1.2",
    "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",
    "end-of-stream": "1.4.4",
    "ecdsa-sig-formatter": "1.0.11",
    "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",
    "get-stream": "6.0.1",
    "gcp-metadata": "4.3.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",
    "hash-stream-validation": "0.2.4",
    "hookable": "5.1.1",
    "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",
    "is-typedarray": "1.0.0",
    "jose": "2.0.5",
    "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.includes": "4.3.0",
    "lodash.clonedeep": "4.5.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.9",
    "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": "0.13.1",
    "retry-request": "4.2.2",
    "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/logger": "0.3.2",
    "@firebase/util": "1.5.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",
    "@panva/asn1.js": "1.0.0",
    "@grpc/grpc-js": "1.6.7",
    "@grpc/proto-loader": "0.6.12",
    "@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": "14"
  }
}
[2022-05-13T06:13:18.680Z] Building nodejs source
[2022-05-13T06:13:18.680Z] Analyzing nodejs backend spec
[2022-05-13T06:13:18.682Z] Could not find functions.yaml. Must use http discovery
[2022-05-13T06:13:18.691Z] Error: spawn ./node_modules/.bin/firebase-functions ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:274:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)

Error: An unexpected error has occurred.

abhay-agarwal avatar May 13 '22 06:05 abhay-agarwal

Looks like you can simply run a yarn install in the .output/server directory and then the emulator works (it was failing because it could not find a node_modules/.bin/firebase-functions command inside that directory). Still need to go in and comprehensively test things.

abhay-agarwal avatar Jun 07 '22 18:06 abhay-agarwal

@abhay-agarwal npm i from .output/server also resolves the problem when using NPM.

Manually copying node_modules/.bin/firebase-functions to .output/server results in another error. Looks like some things are not installed when .output/server/node_modules/ is created.

aaronjsutton avatar Oct 05 '22 17:10 aaronjsutton

closing in favour of https://github.com/unjs/nitro/issues/1370 The emulators issue is tracked there : https://github.com/unjs/nitro/issues/628 The new issue has working instructions that will be added to the documentation shortly.

Hebilicious avatar Jul 01 '23 23:07 Hebilicious