Deploy firebase cloud functions - Invalid function service account - firebase

I am trying to deploy my firebase cloud functions they work fine on local host but when I try to deploy them I get the following error:
{"#type":"type.googleapis.com/google.cloud.audit.AuditLog","status":{"code":3,"message":"Invalid function service account requested: default. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation."},"authenticationInfo":
I tried to play with roles but nothing works any help

Okay so the main problem is in the 11.2.0 version of firebase-tools.
The steps i did to reproduce was simply downgrading to the 11.1.0 version and it worked perfectly!
This is the issue on github and this is the solution suggested by mhotan:
npm install -g firebase-tools#11.1.0

Related

Firebase Next.js Hosting: Unable to find 'esbuild'

I'm trying to use Firebase's new Next.js support for Hosting (see https://firebase.google.com/docs/hosting/nextjs) but I'm getting a weird error when I try to deploy. (Everything runs correctly in the local emulator suite, btw)
Screenshot of Console output with error
When I try to run firebase deploy --only hosting,functions -m "testing out next.js support" I'm getting the error Unable to find 'esbuild'. Install it into your local dev dependencies with 'npm i --save-dev esbuild''. I've already added esbuild to my dev dependencies, and it seems to be installed correctly. My project uses yarn, not npm, but for the sake of testing I tried install it with npm like the error suggested, but that didn't work either.
Has anyone used Firebase Next.js hosting or figured it out since they've released it? The documentation on that page I linked above is... not great.
Make sure that you are using the latest Firebase Tools as per the documentation: "Firebase CLI version 11.14.2 or later".
Run npm install -g firebase-tools to update your version.

Firebase Deployment Error "Error: Functions did not deploy properly."

I have deployed Firebase functions in the past many times. For some reasons, recently (around 2-3 days) I am frequently getting error while deployment. I am using windows to release the code. When I tried with setting up the same project in my Linux system and Mac system the deployment works correctly. What may be the issue for the release from Windows environment.
The following is the issues getting while deployment.
! functions[payment(us-central1)]: Deployment error.
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
Functions deploy had errors with the following functions:
admin
cancellation
cost
createStripeCharge
customer
driver
driverLiveTracking
generalSettings
notification
order
payment
To try redeploying those functions, run:
firebase deploy --only "functions:admin,functions:cancellation,functions:cost,functions:createStripeCharge,functions:customer,functions:driver,functions:driverLiveTracking,functions:generalSettings,functions:notification,functions:order,functions:payment"
To continue deploying other features (such as database), run:
firebase deploy --except functions
Error: Functions did not deploy properly.
Following is the deployment command I am using for
"echo Deploying Functions && npm run lint && npm run build && firebase deploy --only functions"
Please share your knowledge over the issue.
Thanks.
I have resolved this issue. On building, I found that the node modules and lib functions are not replacing correctly with the new build. I have done a name changing previously and that are not reflecting in the new build.
Steps followed:
Removed node modules and lib files
Npm install
Npm run serve
And a new build is worked fine as well. I got the same issue using Jenkins build also. I just manually removed the same in server also.
You can find the issue by examining the actual logs. view them using this command
firebase functions:log
The specific issue will be visible there. I sometimes had error as simple as a missing packages in package.json

Codeship + Firebase functions:config:set = 404 method not found

Hi wonderful people of stackoverflow!
Background
I have an Angular 9 application and CI set up with Codeship. This has been running fine until about two weeks ago when suddenly it stopped working after I upgraded from Angular 7.
Set up commands:
nvm ls
nvm install v10.15.1
nvm use v10.15.1
gem install rb-inotify -v 0.9.10
gem install sass
npm install -g firebase-tools#6.12.0
npm i firebase-functions#3.3.0
yes | npm install -g #angular/cli#9.1.12
npm i
cd functions
nvm use v10.15.1
npm i
cd ..
Which runs as expected. I have checked the versions in the CI environment with npm outdated, which show me that the correct versions are being installed the same as local:
Deploy script:
firebase use default
firebase functions:config:set test="test" --token "$FIREBASE_TOKEN"
firebase deploy --token "$FIREBASE_TOKEN"
Error:
firebase use default is successful, but firebase functions:config:set test="test" --token "$FIREBASE_TOKEN" now returns:
Error: HTTP Error: 404, Method not found.
Notes:
I've reset up the $FIREBASE_TOKEN with the new cli and can confirm that this probably isn't the issue, because when the token is incorrect (I removed the last character from the TOKEN), it throws a different error stating this.
I can also confirm that the same script run locally works and deploys just fine - so while I can get around the problem this way, it isn't an ideal or long term solution.
Any ideas or help would be genuinely appreciated as I'm somewhat lost as to what to do next?
This seems to be related with firebase-tools version. When I installed the same version as you have (6.12.0) I got the same error.
I have tried on new version (I have 8.7.0) and it is working fine with one more remark. When I tried exactly the same command as you have error:
Error: Invalid argument, each config value must have a 2-part key (e.g. foo.bar).
So working command will be like this:
firebase functions:config:set test.test="test"
If you need old version of firebase-tools I tested few other versions and it seems that this is working since version 7.1.0.
For anyone else having this issue - I never managed to solved this sorry. However I migrated my CI over to use GitHub Actions easily and it all works without any issue.

Firebase Functions stopped Working and Can't deploy again

Firebase Cloud functions giving an error called.
Error: Server Error
The server encountered an error and could not complete your request.
Please try again in 30 seconds.
When I try to re-deploy, it gives following error.
Error setting up the execution environment for your function. Please try again after a few minutes.
What could be the reason? Is it following issue?
Sates: https://status.firebase.google.com/incident/Functions/18018
Yes there is an issue with Cloud Functions, as you can see from the link above
Investigating an issue with Functions
Incident began at 2018-03-09 03:30 (all times are US/Pacific).
Last update is this:
Mar 09, 2018 04:45
We are still investigating the issue with Cloud Functions execution. We will provide another status update as soon as possible.
https://status.firebase.google.com/incident/Functions/18018
After the issue is done, you will be able to deploy your functions again using the below:
firebase deploy --only functions
Edit:
I just deployed some functions and it is working now, just takes a bit of time.
I had the same issue and it was fixed after updating firebase-tools. I saw following on my console
Update available 7.0.0 → 7.8.1
Run npm i -g firebase-tools to update
Then i just changed node version and updated firebase tools
nvm use 11
npm upgrade firebase-tools -g
Sometimes switching environment will also help
firebase use dev
Sometimes when some node modules are not installed , the error you get will be like below
Deployment error.
Error setting up the execution environment for your function. Please try deploying again after a few minutes.
Make sure that all node modules are installed prior to deployment, I wasted almost 2 days and realised one node module was not installed .
I tried several different steps, including updating tools from firebase, using different node versions or dependencies on package.json. In the end, at firebase functions console, I cleared the log stack and tried to reach every deployment notification after executing firebase deploy. I found out one of my dependencies were moved from dependencies to devDependencies, which was causing
ERROR: (gcloud.beta.functions.deploy) OperationError: code=13, message=Error setting up the execution environment for your function. Please try again after a few minutes.
Solution:
Place back dependency on its place, moving from devDependencies into dependencies itself.
Update project dependencies with npm install
Re-deploy with firebase deploy

Firebase does not deploy updated version

I am building an "actions on google" application with firebase hosting the node.js back-end.
First deployment was successful and provided a webhook which works fine.
After updating my .js files I run:
firebase deploy --only functions
and get the following output:
=== Deploying to 'monprogrammetele-c5169'...
i deploying functions
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
✔ Deploy complete!
Project Console: https://console.firebase.google.com/project/monprogrammetele-c5169/overview
Everything looks fine except that when I test with the simulator
https://console.actions.google.com/project/......
I still get the old version running....
The only difference I can see between the initial deploy and this one is that firebase is not providing a webhook link like it did the first time:
Function URL: https://us-central1-programmetele-82c89.cloudfunctions.net/teleProgram
I have assumed it is still the same.
The missing URL during deployment was fixed in version 3.16.0 of the CLI. Please upgrade it like this:
npm install -g firebase-tools
Issue was on my side, did some changes on index.js for local testing that were incompatible with firebase. I would suggest though that firebase is more explicit in its debugging messages.
Thanks for the help,
Thierry

Resources