firebase-functions: Cannot deploy private packages with Node 10
Version info node: 10.10.0 / 8.15.0 firebase-functions: 3.1.0 firebase-tools: 7.12.0
[REQUIRED] Test case N/A
[REQUIRED] Steps to reproduce Updating node 8.* to 10.* causes deployment errors. Firebase deploy seem to fail when:
i functions: updating Node.js 10 (Beta) function api(us-central1)...
i functions: updating Node.js 10 (Beta) function projector(us-central1)...
Unfortunately, an unauthorized error is given when accessing a private registry for dependencies. It seems that the .npmrc is ignored as it holds the _auth.
[REQUIRED] Expected behavior Trying to deploy should not fail. For now, I’m still using node 8.
[REQUIRED] Actual behavior
i functions: updating Node.js 10 (Beta) function projector(us-central1)...
⚠ functions[projector(us-central1)]: Deployment error.
Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "`npm_install` had stderr output:\nwarning ../package.json: No license field\nerror An unexpected error occurred: \"https://artifactory.persgroep.cloud/artifactory/api/npm/npm/vary/-/vary-1.1.2.tgz: Request failed \\\"401 Unauthorized\\\"\".\nnpm ERR! code ELIFECYCLE\nnpm ERR! errno 1\nnpm ERR! @ preinstall: `./install-function-dependencies`\nnpm ERR! Exit status 1\nnpm ERR! \nnpm ERR! Failed at the @ preinstall script.\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /builder/home/.npm/_logs/2020-01-15T11_47_09_141Z-debug.log\n\nerror: `npm_install` returned code: 1", "errorType": "InternalError", "errorId": "67EE7395"}}
⚠ functions[api(us-central1)]: Deployment error.
Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "`npm_install` had stderr output:\nwarning ../package.json: No license field\nerror An unexpected error occurred: \"https://artifactory.persgroep.cloud/artifactory/api/npm/npm/accepts/-/accepts-1.3.7.tgz: Request failed \\\"401 Unauthorized\\\"\".\nnpm ERR! code ELIFECYCLE\nnpm ERR! errno 1\nnpm ERR! @ preinstall: `./install-function-dependencies`\nnpm ERR! Exit status 1\nnpm ERR! \nnpm ERR! Failed at the @ preinstall script.\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /builder/home/.npm/_logs/2020-01-15T11_47_09_583Z-debug.log\n\nerror: `npm_install` returned code: 1", "errorType": "InternalError", "errorId": "1600C76E"}}
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 15
- Comments: 39 (3 by maintainers)
We’ve got exactly the same issue, works fine on node 8, but node 10 deployment doesn’t seem to be using the .npmrc file
It seems the problem is still there as of today. I have a private package used by some of my functions. Functions are all using node 10. I placed a
.npmrc
infunctions
directory. It contains something like:Installing, building locally works fine. But at deploy time:
Isn’t the .npmrc of functions directory supposed to be transmitted and used while deploying?
Any update on when this might be fixed??
I’m not sure if this is exactly the same issue, but I’m having very similar problems migrating from node 8 to node 10 - tried multiple times in the last week (and over the past few months) and having the same issue: https://stackoverflow.com/questions/61962810/firebase-cloud-functions-cannot-deploy-to-node-10-upgrading-from-node-8
NB: I do not have any private packages - everything in my package.json is installed from NPM
I can’t fathom how literally nothing has been done yet. I am experiencing this issue with Node 12 & 14.
@andieromero
Thank you for working on it. Since this bug is a blocker for us to launch a new project, I’m happy to help you.
I have couple of questions:
Here’s my logs. I keep getting 404 even though on the local version npm finds and downloads that package no problem.
have you made any special configurations in your functions/.npmrc or other files? I tried so many variations but nothing worked for me. currently my file looks like this:
@kob490 We haven’t taken additional issue since my last comment. We haven’t add any luck having the issue reproduced on our side 😦.
@Ranguna Thanks for giving us another signal. It looks like the issue could be Google project specific or Github NPM package specific?
I am having the same issue when trying to deploy with private packages. I have packages deployed to Github Packages, and it is working fine in local emulator.
I am using nodejs 10 because Node.js 8 is deprecated according to firebase documentation. From what I can tell, it is reading the proper registry from my
.npmrc
file, because the path seems to be correcthttps://npm.pkg.github.com/download/@my-org/models...
, but it’s not reading my auth token which is also specified in the same file.Here is my .npmrc
This is kind of a huge block for me, so it would be appreciated if this issue got a bit more attention.
@andieromero , unfortunately staying on node8 will break dependency of my app. Thus only way to run firebase function with node is to fix the bug, I think.