2

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!

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
Chase Ernst
  • 1,147
  • 1
  • 21
  • 53
  • 1
    If the Firebase CLI is not giving you a helpful error message, contact Firebase support directly to troubleshoot it. https://support.google.com/firebase/contact/support – Doug Stevenson Oct 09 '20 at 15:02
  • That's what I was afraid of. I ended up creating a ticket this morning. – Chase Ernst Oct 09 '20 at 15:12
  • 1
    Did you find any solution to this problem? – markussvensson Nov 02 '20 at 09:01
  • I ended up contacting Firebase support and they escalated it to their functions team and the fixed something in the backend. – Chase Ernst Nov 02 '20 at 16:20
  • @markussvensson it seems that the problem has shown up again. I cannot deploy my functions as of this morning. – Chase Ernst Nov 02 '20 at 16:31
  • 1
    @ChaseErnst my error seems to be caused by a missing (or not accessible) file in the history/restore functionality. Don't know the reason for this. I was able to solve it by simply remove the functions in the web console and then deploy normally >firebase deploy. Worked for me. – markussvensson Nov 02 '20 at 17:21
  • @markussvensson this work around worked for me. Thanks for the info. If you post that as an answer, I will mark it as accepted. I also sent an email back to Firebase support to look into it, as I hadn't done any deployments to break anything. – Chase Ernst Nov 02 '20 at 17:38

2 Answers2

7

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:

  1. Remove the functions in the web console
  2. Deploy normally > firebase deploy
markussvensson
  • 1,630
  • 1
  • 14
  • 18
  • Hitting this today too. By chance did you remove old files from cloud storage in the "artifacts" bucket? I'm wondering if I caused this somehow – xaphod Dec 04 '20 at 21:41
3

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.

petertag
  • 61
  • 5