firebase / firebase-admin-node

Firebase Admin Node.js SDK
https://firebase.google.com/docs/admin/setup
Apache License 2.0
1.62k stars 369 forks source link

Dependency to Node 8 #428

Closed dbacinski closed 5 years ago

dbacinski commented 5 years ago

[REQUIRED] Step 2: Describe your environment

Steps to reproduce:

Runing npm install on node:6 docker base image results in:

cloud-functions@1.0.0 /builds/***/cloud-functions/functions
`-- UNMET PEER DEPENDENCY firebase-admin@6.4.0
  `-- @types/node@8.10.39 

It runs correctly on node:8 base image.

It seems that by accident dependency to node 8 was introduced. But it should work well on Node 6 according to docs. https://cloud.google.com/functions/docs/concepts/nodejs-6-runtime

I am using TypeScript.

google-oss-bot commented 5 years ago

I found a few problems with this issue:

hiranya911 commented 5 years ago

We've had this dependency for many months, and this is the first time somebody has reported an issue about it. We have many developers who use this library on Node 6. We also regularly test on Node 6 without errors. See build logs at https://travis-ci.org/firebase/firebase-admin-node

Also trying this locally, I get a successful installation:

$ node --version
v6.12.3
$ npm install firebase-admin 

> grpc@1.17.0 install /usr/local/google/home/hkj/Projects/firebase-admin-node/temp/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using request for node-pre-gyp https download 
[grpc] Success: "/usr/local/google/home/hkj/Projects/firebase-admin-node/temp/node_modules/grpc/src/node/extension_binary/node-v48-linux-x64-glibc/grpc_node.node" is installed via remote

> protobufjs@6.8.8 postinstall /usr/local/google/home/hkj/Projects/firebase-admin-node/temp/node_modules/protobufjs
> node scripts/postinstall

/usr/local/google/home/hkj/Projects/firebase-admin-node/temp
└─┬ firebase-admin@6.4.0 
  ├─┬ @firebase/app@0.3.5 
  │ ├── @firebase/app-types@0.3.2 
  │ ├── @firebase/util@0.2.3 
  │ ├── dom-storage@2.1.0 
  │ ├── tslib@1.9.0
...

Looks like something else is causing the installation to fail in your Node 6 environment. Can you post a full build log along with you package.json?

hiranya911 commented 5 years ago

This dependency has been in place for over a year (added in 5.4.x release): https://github.com/firebase/firebase-admin-node/pull/98/files

dbacinski commented 5 years ago

package.json:

"dependencies": {
    "@google-cloud/bigquery": "^0.9.6",
    "@google-cloud/firestore": "^0.19.0",
    "@google-cloud/storage": "^1.7.0",
    "algoliasearch": "^3.30.0",
    "babel-plugin-transform-object-rest-spread": "^6.26.0",
    "babel-polyfill": "^6.26.0",
    "babel-runtime": "^6.26.0",
    "contentful": "^7.0.1",
    "fast-csv": "^2.4.1",
    "firebase": "latest",
    "firebase-admin": "^6.4.0",
    "firebase-functions": "^2.0.5",
    "firebase-tools": "^6.1.2",
    "fs": "^0.0.1-security",
    "google-oauth-jwt": "^0.2.0",
    "json2csv": "^3.11.1",
    "lodash": "latest",
    "moment": "^2.22.2",
    "moment-timezone": "^0.5.21",
    "npm": "^6.4.1",
    "os": "^0.1.1",
    "path": "^0.12.7",
    "protobufjs": "^6.8.8",
    "slack-node": "^0.1.8",
    "sparkpost": "^2.1.2"
  },
  "devDependencies": {
    "@types/algoliasearch": "^3.30.1",
    "@types/jest": "^22.2.3",
    "@types/lodash": "^4.14.116",
    "babel-cli": "^6.24.1",
    "babel-jest": "^22.4.4",
    "babel-plugin-rewire": "^1.1.0",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-preset-env": "^1.7.0",
    "jest": "^23.5.0",
    "nodemon": "^1.18.3",
    "ts-jest": "^22.4.6",
    "tslint": "^5.11.0",
    "typescript": "^2.9.2"
  },

failing build log:

Running with gitlab-runner 10.4.0 (857480b6)
  on as-gitlab-ci (d83a8761)
Using Docker executor with image node:6 ...
Using docker image sha256:ead1c8101c563b0ca19f258e17c26cab1d945d4de1e9a87e5a72b804e8334539 for predefined container...
Pulling docker image node:6 ...
Using docker image node:6 ID=sha256:92e70210897bdb33a15eb7a50c34762643bcf3456dcf7a3c92c3c3ee92c94e73 for build container...
Running on runner-d83a8761-project-3441569-concurrent-0 via as-gitlab-ci...
Fetching changes...
Removing functions/jest_0/
Removing functions/lib/
Removing functions/node_modules/
HEAD is now at 5d9e28d Added tests to broken marks checkup
From https://gitlab.com/***
   78f425c..e0928b8  master     -> origin/master
Checking out e0928b8d as master...
Skipping Git submodules setup
Checking cache for default...
Successfully extracted cache
$ cd functions
$ npm install
cloud-functions@1.0.0 /builds/***/functions
`-- UNMET PEER DEPENDENCY firebase-admin@6.4.0
  `-- @types/node@8.10.39 

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.3 (node_modules/sane/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.2 (node_modules/nodemon/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN firebase-functions@2.0.5 requires a peer of firebase-admin@~6.0.0 but none was installed.
npm ERR! code 1

and one day before it was passing with similar warnings:

Running with gitlab-runner 10.4.0 (857480b6)
  on as-gitlab-ci (d83a8761)
Using Docker executor with image node:6 ...
Using docker image sha256:ead1c8101c563b0ca19f258e17c26cab1d945d4de1e9a87e5a72b804e8334539 for predefined container...
Pulling docker image node:6 ...
Using docker image node:6 ID=sha256:92e70210897bdb33a15eb7a50c34762643bcf3456dcf7a3c92c3c3ee92c94e73 for build container...
Running on runner-d83a8761-project-3441569-concurrent-0 via as-gitlab-ci...
Fetching changes...
Removing functions/jest_0/
Removing functions/lib/
Removing functions/node_modules/
HEAD is now at 78f425c Fixed practice cache update trigger on practice change
From https://gitlab.com/***
 * [new tag]         cloud-functions-v4.14 -> cloud-functions-v4.14
Checking out 78f425cd as cloud-functions-v4.14...
Skipping Git submodules setup
Checking cache for default...
Successfully extracted cache
$ cd functions
$ npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.3 (node_modules/sane/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.2 (node_modules/nodemon/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN firebase-functions@2.0.5 requires a peer of firebase-admin@~6.0.0 but none was installed.
hiranya911 commented 5 years ago

@dbacinski I managed to successfully build a Node 6 Docker image using your dependency set. See the attached log. I got the same warnings as you did, but no errors.

docker-build.log

I can also say that nothing has changed at our end between your successful build and the failing build. The latest firebase-admin release is v6.4.0, released about a week before this issue was first reported. I don't know what could have caused the difference in behavior. May be an out-of-date shrinkwrap file or a package.lock file in your project? Or perhaps something to do with gitlab-ci (perhaps they started enforcing npm peer dependencies)?

Only concrete recommendation we can make is to not use firebase-admin@6.4.0 alongside firebase-functions@2.0.5. That peer dependency is declared as ~6.0.0, so installing 6.4.0 is not recommended.

I think you should follow up this issue with the gitlab community, since that seems to be the only environment where this can be reproduced. I will close this for now. But if you can provide a standalone repro (a Dockerfile or something similar that I can locally test), I'd be happy to take another look.