Firebase auth:export stuck in endless loop - firebase

I have a backup-script that runs as a kubernetes cronjob every night and 3 nights ago the firebase auth:export started just looping. I can see that it exports everything fine and on the last row "Exported 57 account(s) successfully." it is normally done and writes the file to our bucket but now it just loops around and starts exporting again.
This is the command i use:
firebase auth:export firebase_auth_$(date +"%Y-%m-%d").json --project ${PROJECT_ID} --token "$(cat /var/secrets/firebase/token.txt)"
I have tried running the CLI locally and run into the same problem, i can't seem to find the issue when i google either. The documentation does not mention any property to loop or stop when all users are exported. Is there any flag/property like that or should this just work?

Turns out that this is a known issue:
https://github.com/firebase/firebase-tools/issues/1643
From the GitHub issue:
partially solved in 7.3.1 and probably a new fix coming due to #1642 in the next version.
So basically it's still a bit broken, even in 7.3.1. Better wait for the next version I guess.

Related

Suddenly can no longer deploy functions to Firebase project

using express app as function. my functions engines:node was set to 12. I had to upgrade node locally -- so I also updated engines:node to 16. suddenly couldn't deploy the functions, I reverted back to engines:node 12. Still can't deploy functions. Seeing this error:
Missing URI for HTTPS function in printTriggerUrls. This shouldn't happen
And a bunch of messages referring to previously deployed functions:
Could not find image for function
Extremely frustrated... tried reinstalling all the local npm packages with no luck.
The solution that finally worked was to delete all the previously deployed functions and re-deploy all the functions fresh.
Try running this command to see the logs
firebase functions:log

Time Zone of Cloud Functions for Firebase Scheduler does not change

I am currently creating and deploying a function to be executed periodically in the Cloud Functions for Firebase scheduler as shown below.
The key point is that I want it to be executed every day at 0:05 Japan time as .timeZone('Asia/Tokyo').
The deploy itself is working fine, but when I look at the content in GCP's Cloud Scheduler, the Time Zone is set to (America/LosAngeles) as shown in the image below, and the actual execution time is off from Japan time.
I manually changed the time zone to Japan time in the Cloud Scheduler function management screen and confirmed that the desired behavior was achieved, but when I deploy the function again, it is still set to (America/LosAngeles).
I thought it might be affected by the region of GCP itself, and that I would have to change the region of GCP, but I haven't found where I can change it from.
However, I thought that I should be able to specify the .timeZone for each function from the code. I'm at a loss.
I don't know how to solve this problem, and I'm wondering if anyone can help me.
exports.XXX = functions.pubsub
.schedule('every day 0:05')
.timeZone('Asia/Tokyo')
.onRun((context) => {
///省略
});
Thank you in advance.
I have experienced the same problem too. There's also a similar question asked here and the solution to downgrade the firebase-tools works for me.
This could be related to your CLI version, Make sure it is updated and if you keep experiencing issues, you should contact firebase support to submit a bug request HERE.
Another solution is that the region could be set as undefined inside your Google Cloud Platform (GCP) resource location.
Just be warned that setting the GCP location isn't recommended unless you know what you are doing and you want to set all your default locations.
Reference: default-cloud-location
firebaser here
It looks like there is a bug in version 9.12 of firebase-tools that forces all Cloud Functions to be deployed in pacific timezone, regardless of the timezone you set in the code.
Upgrading to version 9.12.1 should fix the problem. For further details on the problem, see this issue on the Github repo.

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 CLI tool is freezing when I type 'firebase init'

I installed the firebase command line tool and logged in successfully. I type
firebase init
in terminal, within my project directory, and I get the option to choose Database, Functions, or Hosting. I use the arrows and space bar to select Functions, press enter, and am presented with a list of projects. From this point forward I cannot do anything in terminal. I have to quit terminal in order to use it again. I am running OSX El Capitan, 10.11.6. I contacted Apple Support and they recommended talking with Firebase first, who in turn recommends asking stack overflow first. Any idea what the problem may be?
See the comment above, Node v8.0 and 8.1 both had regressions that broke the Firebase CLI. I upgraded my version of Node from 8.1.0 to 8.1.3, and everything works fine.

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).

Resources