Firebase Function not being deployed in flutter

372

It's a eslint error. Check the following error messages.

Running command: npm --prefix "$RESOURCE_DIR" run lint

functions@ lint /Users/johnny/Downloads/flutterApp5/functions eslint .

/Users/johnny/Downloads/flutterApp5/functions/index.js 18:5 error Expected catch() or return
promise/catch-or-return 23:13 error Each then() should return a value or throw promise/always-return 28:13 error Expected catch() or return promise/catch-or-return 28:13 warning Avoid nesting promises
promise/no-nesting 33:21 error Each then() should return a value or throw promise/always-return 45:19 warning Avoid nesting promises promise/no-nesting 45:19 warning Avoid nesting promises promise/no-nesting 48:27 error Each then() should return a value or throw promise/always-return

✖ 8 problems (5 errors, 3 warnings)

You should edit your code to fix error, or change promise/catch-or-return and promise/always-return rules from error to warn in your .eslintrc.json configuration file.

See https://github.com/xjamundx/eslint-plugin-promise

In addition

npm --prefix "$RESOURCE_DIR" run lint command is functions.predeploy setting in the firebase.json file.

Like this.

{
...
  "functions": {
    "predeploy": [
      "npm --prefix \"$RESOURCE_DIR\" run lint",
      "npm --prefix \"$RESOURCE_DIR\" run build"
    ]
  },
....
}
Share:
372
Admin
Author by

Admin

Updated on December 21, 2022

Comments

  • Admin
    Admin over 1 year

    I am trying to deploy firebase function for flutter application which is being created in android studio. While deploying I am receiving following error. How should I resolve it?

    Running command: npm --prefix "$RESOURCE_DIR" run lint

    functions@ lint /Users/johnny/Downloads/flutterApp5/functions eslint .

    /Users/johnny/Downloads/flutterApp5/functions/index.js 18:5 error Expected catch() or return
    promise/catch-or-return 23:13 error Each then() should return a value or throw promise/always-return 28:13 error Expected catch() or return promise/catch-or-return 28:13 warning Avoid nesting promises
    promise/no-nesting 33:21 error Each then() should return a value or throw promise/always-return 45:19 warning Avoid nesting promises promise/no-nesting 45:19 warning Avoid nesting promises promise/no-nesting 48:27 error Each then() should return a value or throw promise/always-return

    ✖ 8 problems (5 errors, 3 warnings)

    npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! functions@ lint: eslint . npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the functions@ lint script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

    npm ERR! A complete log of this run can be found in: npm ERR!
    /Users/johnny/.npm/_logs/2020-06-14T01_33_52_121Z-debug.log

    Error: functions predeploy error: Command terminated with non-zero exit code1