2
votes

I'm trying to deploy my firebase functions but all the functions return me error, I had already deployed before without any error. I did not install anything new since the last time that a deploy was correct. Every functions return almost the same error, the only thing that changes is the "errorId"

I have tried to logout from firebase-cli and login again, i have updated firebase-tools, firebase-admin, firebase-functions from npm. I'm deploying with firebase deploy --only functions

Deployment error. Build failed:

{
  "error": {
    "canonicalCode": "INVALID_ARGUMENT",
    "errorMessage": "`npm_install` had stderr output:\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@types/lodash-973f4ada/common/collection.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@types/node-29231f2f/inspector.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@types/node-f1c8db24/inspector.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@firebase/auth-1b85ce5b/dist/auth.esm.js.map'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@firebase/webchannel-wrapper-e6854ec7/dist/index.js'\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-08T18_16_17_266Z-debug.log\n\nerror: `npm_install` returned code: 1",
    "errorType": "InternalError",
    "errorId": "FD2536C1"
  }
}

Package.json :

{
  "name": "functions",
  "engines": {
    "node": "8"
  },
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "lint": "eslint .",
    "serve": "firebase serve --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "dependencies": {
    "@firebase/storage": "^0.2.16",
    "@google-cloud/vision": "^0.24.0",
    "@sendgrid/mail": "^6.4.0",
    "cors": "^2.8.5",
    "dateformat": "^3.0.3",
    "firebase": "^5.11.1",
    "firebase-admin": "^7.4.0",
    "firebase-functions": "^2.3.1",
    "json2csv": "^4.5.1",
    "mailchimp-api-v3": "^1.13.0",
    "moment-timezone": "^0.5.25",
    "openpay": "^1.0.3",
    "paypal-rest-sdk": "^1.8.1",
    "request": "^2.88.0"
  },
  "devDependencies": {
    "eslint": "^4.12.0",
    "eslint-plugin-promise": "^3.6.0",
    "firebase-functions-test": "^0.1.6"
  },
  "private": true
}

Correct deploy of the functions.

Update*** I have tried to delete everything and uninstall every package except for the ones required for firebase-functions and start over with one test function in node 8 i'm having the same issue, with node 6 it was deployed, but i need to use node 8 because i need to use await/async

3
Could you expand a lutter more about tour setup? We need more information to help youandresmijares
Its complairont about missing package, havé u triés installing thèm? Most of them are types, maybe uses but libraries you are usingandresmijares
Yes, i have installed them all...Santiago Carrancá
I have a similar setup. However, it fails when I use a private github dependency: e.g. ` "dependency": "github:org/repo#v1.0.0" `sharly

3 Answers

3
votes

I had a similar deployment failure. I think it was caused by me running firebase deploy from the app directory rather the the app\functions directory. In any case, I ran the following commands from the terminal (using VSCode in my case) having changed into the app\functions directory. Deployment then worked perfectly.

npm install --save @google-cloud/storage
npm install --save firebase-admin@latest
npm install --save firebase-functions@latest
firebase deploy

Hope that helps.

0
votes

I had similar issue and it ended up being a missing module in my package.json

You can view more detailed / useful logs here: https://console.cloud.google.com/logs

0
votes

you can examine the actual logs by using this command to open the log

firebase functions:log

The specific issue will be visible there. I sometimes had error as simple as a missing packages in package.json

It would have been much helpful if firebase could show better info on the errors directly. but at least we can find them here.