Why am I no longer able to deploy functions (Error 503)? - firebase

No longer able to deploy cloud function via "firebase deploy" command - receiving error: "HTTP Error: 503, The service is currently unavailable"
I previously had a single function deployed and working until a slight modification was causing an authentication error, so I temporarily deleted it until I had time to fix the error.
So a couple days pass, I modify the original code (just added a bit of code relating to service account credentials, didn't even modify the actual function) and tried to re-deploy it (using 'firebase deploy') however it's throwing the following error: "HTTP Error: 503, The service is currently unavailable".
I thought maybe the service is currently down, but Firebase Status Dashboard shows all services are green and noone else seems to be complaining about this error at the moment. I've tried reinstalling/updating firebase-tools and even reverting the functions index.js code back to what it had been when I last successfully deployed, but same error every time. I don't think it has anything to do with the code on my end, but perhaps some weird bug relating to my account/api/authentication.
I've submitted a tech support question on firebase and am awaiting response, but thought I'd try my luck here as well.
Any suggestions?

After some back and forth with firebase technical support, turns out it is some strange bug on their server end (in relation to this particular project) as I'm able to deploy the same functions no problem to other projects. It may have been "triggered" initially by hitting a function invocation quota when I was having issues with one of the functions in the past (an issue which somehow caused the function to be repeatedly called until I realized and deleted it 2 days after). However the project should no longer be limited and I still am unable to deploy any functions on that particular project.
The issue has been handed onto their engineers and hopefully will have it resolved on their end soon.

Related

Cloud Functions Deployment Error build step 3

Just recently I am starting to experience an issue when trying to deploy my functions through Firebase. When running the command firebase deploy --only functions one of my four functions deploy correctly, but the other three throw this error in the firebase-tools console:
Deployment error.
Build failed: Build error details not available. Please check the logs at url to my GCP logs
When I look at the logs the error message that shows for each function that is failing is:
ERROR: build step 3 "us.gcr.io/fn-img/buildpacks/nodejs10/builder:nodejs10_20200922_20_RC00" failed: step exited with non-zero status: 46
I have searched and googled for quite a while now and I cannot find anyone reporting the same error code, having the same non-zero status returned, or having functions fail on step 3. There doesn't seem to be much for documentation on troubleshooting the errors either.
Hopefully someone here can point me in the right direction.
Thanks!
The error seems to be caused by a missing (or not accessible) file in the history/restore functionality of Firebase. Don't know the reason for this.
A workaround that worked for me was:
Remove the functions in the web console
Deploy normally > firebase deploy
Answering since I can't comment in response to xaphod, Markus's fix worked for me, thank you mate! Deleting the function means it creates a new one rather than trying to restore it, which is the failed step 3 in the build process.
In response to xaphod, I did setup a lifecycle rule for old files in the artifacts bucket, it was by far my biggest bucket in storage and was pushing the free tier limit. I set it up a bit short probably, delete 5 days after last updated time, but surprisingly didn't run into this issue until today (possibly because I usually just deploy them all whenever I update one). I removed the lifecycle rule for now, although I'd rather it not run up the storage space again, I might end up contacting support to see if there's a way to lifecycle them without deleting the most recent, not sure why it doesn't just clear out the old images on updates though.
Found the post that suggested setting up lifecycle rules, firebase storage artifacts is huge, and did some testing as well, deleted all the files in us.artifacts and deployed all my functions (got errors on all them, only deleted the function that I needed to update earlier and deployed it by itself). Doesn't cause any errors, just takes a bit longer, so I think the issue can be fixed by deleting them all or deleting nothing, probably going to set the lifecycle rule to delete immediately and deal with the increased deploy time, rather than the cost of firebase storage.

Firebase error: "Authentification key is not active"

Prior a week from today, I had code that was working fine on Firebase Cloud Functions.
I've tried numerous solution to debug the problem but have run into this wall every time my code is activated:
{"errors":[{"code":20,"message":"Authentification key is not active"}
{"code":21,"message":"No permission for this authentication key"}]}
One solution had changed this error code into another:
{"error":{"code":403,"message":"Identity Toolkit API has not been used in project xxxxxx before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/identitytoolkit.googleapis.com/overview?project=xxxxxx then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.","errors":[{"message":"Identity Toolkit API has not been used in project 818729994826 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/identitytoolkit.googleapis.com/overview?project=xxxxxx then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.","domain":"usageLimits","reason":"accessNotConfigured","extendedHelp":"https://console.developers.google.com"}],"status":"PERMISSION_DENIED"}}
Which leads me to believe that this is authenticated related even though the code is hosted in a Google domain which I assume should be automatically authenticated.
Okay. I found the source of my error and the log response is not from Google but from my own code.
I am working in a team and it is without my knowing that one of my member of my team made some changes (unfortunately this is the environment I am working on so no git or mention what changes is happening).
Procedures to come to this conclusion is akin to disabling one plug-in at a time in Wordpress.
I broke my code apart in pieces and ran them and they ran perfectly fine. Until I came across a code that was talking to api and therefore spitting out this error.
Hope that helps anyone going through some big unknown in error debugging. Also, probably a nice caveat to learn unit testing.

Firebase Functions: "Failed to get status of functions deployments"

I am getting a very strange error when I attempt to deploy my firebase functions.
As a test to rule out my code, I deleted everything except the require(firebase-functions); statement in my index.js file and then tried to deploy, but I again received the same error message:
Error: Failed to get status of functions deployments.
It also prompts me to see my function log file, but there is nothing new or relevant outputted there. Anyone have any idea how to fix this?
Please be sure you have the right nodejs version. Also for any issue regarding firebase product, the status can be checked in this link:
https://status.firebase.google.com/
The above link will provide a status for each service.
When the issue gets solved, you can just deploy your functions again with a different name instead of deleting or just redeploy them.
Edit:
Currently in the link above the issue is listed there, there is currently Service Disruption.
Please check this:https://status.firebase.google.com/incident/Functions/18003
to know when this issue will be solved as the firebase team has seen that there is a problem.
firebaser here
There is an ongoing issue with deploying Cloud Functions through the Firebase CLI. To track its status, look a the Firebase status page.
Update: the issue was fixed at 7:22 am PST.
I just successfully deployed some of my own functions, which was failing earlier. Thanks for your reports and patience everyone!
I was getting this error when there were no deployment issues mentioned on the status page.
It turned out that the project just needed to "Link a billing account".
This can be done via the Billing section on Google Cloud Platform.

Why are my Firebase Functions deploys (from the Netherlands) failing?

Update: The problems passed for a while, but then returned with a vengeance since yesterday. Deploys now really take forever and always fail with Server Error. connect ETIMEDOUT or Upload Error: Cannot read property 'response' of undefined or something else.
After experimenting with connecting via a US location using HideMyAss I found that that completely resolved my issues though! Note that this issue not only occurs when deploying from our office in Amsterdam, but also from our office in Rotterdam. In the meanwhile I have also heard from more people experiencing issues with other Google services.
I have replied to the related Firebase Support email with this information and hope they will look into it. In the meanwhile I guess I'll have to keep on using HideMyAss..
--
Deploying Functions has been taking increasingly longer times after adding more of them. Occasionally at first, but recently for some periods every time I try to $ firebase deploy --only functions one of the functions being deployed at random fails with:
⚠ functions[foo]: Deploy Error: Failure in the
execution environment
When I try again an hour or so later it deploys without a problem (still takes 2 minutes to deploy which seems a little slow).
Perhaps the deploy process is timing out; it always fails after a long time, never quickly.
Perhaps my location outside of America is resulting in latency related issues in the deployment process? Doesn't seem very likely though..
I'm also looking into Firebase Functions logging "Function execution took 60002 ms, finished with status: 'timeout'" and other performance issues, so I wonder if these are all related.
PS: I also reported this to https://firebase.google.com/support/ but the last report I made there is still un-answered after 15 days, so I'm going to go ahead and post it here as well. I included a firebase-debug.log with that report, but rather not publicly sharing that here (not sure if there any tokens in there etc).
Also having issues
I have been having similar issues today and I am deploying from the United States.
For example a function will fail showing these two errors:
Deploy Error: Failure in the execution environment
Error: Functions did not deploy properly.
I found that once when this happened it was because my internet connection was dropping and then totally dropped during a firebase deploy.
Then again it happened because I was trying to deploy at the exact same time that at lot of my cloud functions happened to kick off doing stuff on their servers.
Once the cloud function had failed, then even when my internet resumed and my functions weren't busily running, it would not let me redeploy to get the jammed function running again. No matter what the broken copy of it was stuck in their servers with the tag:
Failure in execution environment
My Solution
I found that once you have a problem like that you can actually rename the function. On the next deploy it will effectively delete the old broken function and reload it as a working copy with the new name.
I would think if your project required it to have the same name you could do this process one more time, deleting the copy with the new name and restoring the copy with the name you needed. Or even block commenting out the function to delete it on the first deploy and then uncommenting it on another deploy to reinstall it.
How that helps you
I'm hoping that if you are still having issues from the Netherlands it is helpful to know that it may be a slow connection issue or a busy server issue. As I have found these two things to cause problems for me from within the States.
Also my solution of deleting and redeploying the function might help to speed up a deploy if the issue is with a copy that is on their servers. It would be interesting to know if that helps because even though the function looks ok on the server maybe it had issues during the previous deploy that are jamming up future deploys.
Sorry for the late response to this, hopefully you are no longer having these issues with firebase (I hate firebase btw, always issues like this).

Meteor app "breaks" when deployed (wrong login parameters, gets stuck in requests)

I have created my first meteor app today and am kind of stuck. Everything works extremely well on localhost:3000, very responsive etc. It is a simple task app, where users can post tasks to a feed that displays all tasks an then claim those tasks, removing them from the general feed and putting them into their personal feed. But when I deploy it to a meteor.com server, everything breaks.
This is the js file
https://github.com/valentin-zambelli/brokenjs/blob/master/mvp.js
Accounts.ui.config({
passwordSignupFields: "USERNAME_ONLY"
});
gets ignored and whenever I try to post a new task the page reloads, getting stuck on app.meteor.com/?text=some+new+task and doesnt display the task in the general taskfeed.
I have removed the insecure and autopublish package. Is there anything I am missing here? It kind of seems as if it uses an older, broken build. I also get the ReferenceError: Can't find variable: require when deploying, but I can't really figure out where this is coming from.
I hope someone can help me.
Ok, it was an insanely stupid mistake on my part: The mongodb was still in an older state and caused a conflict. If you have problems deploying your meteor app try
meteor deploy myapp.meteor.com -- delete
This will delete all resources on the server, including the database. Then do a simple
meteor deploy myapp.meteor.com

Resources