Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase deploy cloud functions suddenly doesn't work anymore

I am very confused. I've had no problems at all for a long time, and now I suddenly can't deploy anymore. I can't remember doing anything that could have caused this.

I have 3 different cloud functions. When I ran firebase deploy I got what seemed to be the same error for each one:

!  functions[generateThumbs(europe-west1)]: Deployment error.
Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "`npm_install` had stderr output:\nnpm WARN tar ENOENT: no such file or directory, lstat '/workspace/node_modules/.staging/sharp-261f9e9e/docs/image'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/firebase-admin-a1197e24/lib/auth/token-verifier.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@types/lodash-973f4ada/common/math.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/sharp-261f9e9e/docs/index.md'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@types/lodash-973f4ada/common/number.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@types/lodash-973f4ada/common/object.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@google-cloud/storage-66ff4fa1/build/src/channel.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@google-cloud/storage-66ff4fa1/build/src/channel.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/express-5648fc3a/index.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@google-cloud/storage-66ff4fa1/build/src/file.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/express-5648fc3a/LICENSE'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/tar-253f970f/lib/update.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/express-5648fc3a/Readme.md'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/tar-253f970f/lib/warn-mixin.js'\nnpm WARN tar ENOENT: no such file
or directory, open '/workspace/node_modules/.staging/tar-253f970f/lib/winchars.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/tar-253f970f/lib/write-entry.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/xregexp-5f45e5d3/MIT-LICENSE.txt'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/ast-types-c8750e07/gen/namedTypes.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/ast-types-c8750e07/gen/nodes.d.ts'\nnpm ERR! code E404\nnpm ERR! 404 Not Found: [email protected]\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR!     /builder/home/.npm/_logs/2019-06-21T23_38_41_651Z-debug.log\n\nerror: `npm_install` returned code: 1", "errorType": "InternalError", "errorId": "1A98E1A1"}}

I googled, and someone said to delete package-lock.json, so i did. I ran npm install and it gave me these warnings:

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Jesper\intergun\functions\node_modules\concat-stream\node_modules\isarray\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Jesper\intergun\functions\node_modules\firebase-functions\node_modules\ms\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Jesper\intergun\functions\node_modules\through2\node_modules\isarray\package.json'

Then i tried firebase deploy --only functions, and I got this error for each cloud function:

!  functions[generateThumbs(europe-west1)]: Deployment error.
Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "`npm_install` had stderr output:\nnpm ERR! Cannot read property 'match' of undefined\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR!     /builder/home/.npm/_logs/2019-06-21T23_51_11_275Z-debug.log\n\nerror: `npm_install` returned code: 1", "errorType": "InternalError", "errorId": "70391B03"}}

Why is this suddenly happening, and what can I do to fix it? Please help.

like image 397
Jesper Avatar asked Jun 21 '19 23:06

Jesper


People also ask

Why does cloud deployment fail?

Cloud Functions deployment can fail if the entry point to your code, that is, the exported function name, is not specified correctly. Your source code must contain an entry point function that has been correctly specified in your deployment, either via Cloud console or Cloud SDK.

What does Firebase deploy -- only functions do?

Running firebase deploy --only functions deletes the existing functions before creating new ones.


1 Answers

The error messages are saying there are things missing in your node_modules folder. Delete the entire node_modules folder, then npm install again.

like image 110
Doug Stevenson Avatar answered Sep 27 '22 19:09

Doug Stevenson