skip to Main Content

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 E404nnpm ERR! 404 Not Found: [email protected] ERR! A complete log of this run can be found in:nnpm ERR!     /builder/home/.npm/_logs/2019-06-08T18_16_17_266Z-debug.lognnerror: `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

4

Answers


  1. I had a similar deployment failure. I think it was caused by me running firebase deploy from the app directory rather the the appfunctions directory. In any case, I ran the following commands from the terminal (using VSCode in my case) having changed into the appfunctions 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.

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
  3. Checking the log

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

    firebase functions:log
    

    Doing this is really helpful since specific issue will usually be visible there. I sometimes even had error as simple as a missing package name 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.

    I hope it helps

    Login or Signup to reply.
  4. Firebase functions:log really helps! In my case I had not enabled signin method in the firebase project (:

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search