Reputation: 9886
I'm getting There was an unknown problem while trying to parse function triggers. Please ensure you are using Node.js v6 or greater
when trying to do firebase deploy --only functions
I tried with node -v v10.10.0
node -v v8.11.1
node -v v10.15.3
Background: this is a project that I develop 6 month ago, it worked with no issue, but today I tried to re-deploy (no changes in the code) and I get this error.
I have no idea how to work from here, would appreciate any idea.
here is the full log:
firebase deploy --only functions
=== Deploying to 'invoice-manager-251609'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> functions@ lint D:\work\ocr\receiptWeb\functions
> eslint .
D:\work\ocr\receiptWeb\functions\index.js
127:25 warning Avoid nesting promises promise/no-nesting
127:25 warning Avoid nesting promises promise/no-nesting
128:35 warning Don't make functions within a loop no-loop-func
132:40 warning Avoid nesting promises promise/no-nesting
132:40 warning Avoid nesting promises promise/no-nesting
134:44 warning Avoid nesting promises promise/no-nesting
146:38 warning Don't make functions within a loop no-loop-func
424:28 warning Avoid nesting promises promise/no-nesting
424:28 warning Avoid nesting promises promise/no-nesting
465:28 warning Avoid nesting promises promise/no-nesting
465:28 warning Avoid nesting promises promise/no-nesting
D:\work\ocr\receiptWeb\functions\ReceiptGv.js
368:43 warning Don't make functions within a loop no-loop-func
✖ 12 problems (0 errors, 12 warnings)
+ functions: Finished running predeploy script.
i functions: ensuring necessary APIs are enabled...
+ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
Error: There was an unknown problem while trying to parse function triggers. Please ensure you are using Node.js v6 or greater.
NOTE: the warnings are not new, and I could deploy the project with them in the past.
sometimes it gives this addiation line Having trouble? Try again or contact support with contents of firebase-debug.log
but I couldn't find any info about firebase-debug.log
in google.
Upvotes: 2
Views: 2702
Reputation: 1
Check if you are running the app in the same port that is going to be deployed. In my case a just had to stop running the script locally and it worked with no problem
Upvotes: 0
Reputation: 11
There is no need to update Node versions or dependencies we often run the command:
firebase deploy --only functions
use these simple steps:
1: Go to the package.json file
in the script object add the following:
"deploy": "firebase deploy --only \"functions:<your function name>\"",
it will look like this:
"scripts": {
"lint": "eslint .",
"serve": "firebase serve",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only \"functions:app\"",
"logs": "firebase functions:log"
},
2: then run this deploy script from package.json file.
it will work!.
Upvotes: 0
Reputation: 624
There was a bug in firebase-tools (I can't remember what version now) which was fixed. Just make sure you have the latest running:
npm install -g firebase-tools@latest
Upvotes: 0
Reputation: 725
Please check your Node version by typing ( node -v ) in your console or Terminal and also check your Package.json which is inside functions and check the below code.
"engines": {
"node": "14"
},
The above means I want to deploy firebase. In this case, I should already install node 14 or 14 + version on my pc.
Upvotes: 0
Reputation: 81
Installing a different node verion didn't work for me, but removing the node-modules
folder from functions and then re-installing dependencies did.
Upvotes: 8