Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Cloud Function stuck in "failed to deploy"

Hi!

I have a Cloud Function Gen2 that failed to deploy when it was first created. After fixing the issue, the Function is now perpetually stuck in a state of "failed to deploy"

There are no error messages in the logs. The Function does update and the underlying Cloud Run instance updates and runs successfully too. The Function logs tell me “Default STARTUP TCP probe succeeded after 1 attempt”.
The function does update if I redeploy. But I can’t redeploy from the UI as the deploy button is greyed out.

I’ve got about 8 other functions that all seem to work, it’s just this 1 that is stuck without any added information about why.

I’ve tried deleting it and recreating it but it’s still stuck.

What can i do to fix this?

0 2 535
2 REPLIES 2

Hi @DustinSilk,

Welcome to the Google Cloud Community!

We need to get to the root of what's causing the Cloud Function to be stuck in "failed to deploy"

To monitor your runtime logs, you can view it in the Cloud Logging UI. You can refer to Viewing Runtime Logs which leads to viewing your logs in the Google Cloud CLI. 

To view logs via the command line, you can use the command below to view logs, we will add the --gen2 flag as you are using 2nd gen Cloudn fucntion:

gcloud functions logs read --gen2

 to view the logs for a specific function, include the function name like so:

gcloud functions logs read FUNCTION_NAME --gen2

 You can also view runtime logs for Cloud Functions in the Google Cloud Console.

Check out this GCC post about a Cloud Function being stuck and failed deployment, as you might have the same issue.

Basically what you will do here is go to the storage container and restore the code version to the oldest version. Which then leads the function build to fail so that you can Edit and Redeploy it. 

If the above options don't work, you can contact Google Cloud Support to further look into your case. Let me know if it helped, thanks!

Thanks for the response! I've been through that issue and its slightly different to my issue:

  • My "Edit and redeploy" button still works, but once I open the edit window and click "Next", it's the final "Deploy" button that is greyed out and doesn't work when set to "Last successful deployment". If i change it to the source zip file in cloud storage, I can click deploy but nothing happens.
  • When I deploy via the command line using the source zip file in Cloud Storage, the deploy is successful and there aren't any errors or warnings. The error still shows in the Function UI.
  • I can manually delete the Function, but if I deploy it again, it is still stuck with the red error in the UI, even though the function is working correctly.
  • When I click on the error shown in the UI, it links me back to an old failed build in Cloud Build.
  • When I delete the source zip file in Cloud Storage and rebuild + deploy the function, it still shows the error in the Function UI and I still can't deploy edits from the UI.

It seems like the only way to contact support is to subscribe to Googles support program, which is a little unfair considering there's clearly some kind of bug/issue that is out of my control.