-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cloud Function deployment is Flaky: Error code 3, message: Failed to retrieve function source code #6132
Cloud Function deployment is Flaky: Error code 3, message: Failed to retrieve function source code #6132
Comments
cc @angelchang |
Encountering same issue without use of project-factory.
|
My initial assumption is that object creation might be returning successful before the object is fully propagated. |
Console UI shows that object was uploaded in bucket before function attempted to deploy. I also tried adding a sleep on the functions deployment triggered by the object upload. |
This seems to me an eventually consistency issue, when i separate out the project creation from the rest of the config it works fine all time. Discussing with another developer feels the same. I would recommend separate out the project config or implement some explicit delays on the project creation. As provider function is limited here, i am closing this issue now. Please reopen if you feel otherwise |
@venkykuberan Thanks for looking into this! I had a couple of followup questions.
|
@bharathkkb Yes its a limitation on the GCP side, we observed this pattern between Project API and Storage APIs. We have an active issue #5649 to track that. |
@venkykuberan makes sense. Thank you |
Hi @venkykuberan |
If apply immediately after failure works, that implies that we should have the resource retry the create until the API is consistent. |
@danawillow yes, apply immediately after has been consistently working |
When you run into this issue, do you happen to notice whether it tries to recreate the cloud function in the second apply? i.e.
Mostly, I'm wondering when this error happens whether we need to retry creation of the function or if it's that the operation returns an error but the function was actually created properly. |
@emilymye
|
Hello everyone, I have the same issue. Seems that GCP uses own internal source code storage bucket and synchronize it eventually. Adding null_operator for wait doesn't help. When I get errorError:
I can see the situation that I could not download code if I press download button. But in my src_object source code already exists by the time of function creation. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Community Note
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
Terraform v0.12.20
Affected Resource(s)
Terraform Configuration Files
Example Py function
Debug Output
https://gist.github.com/bharathkkb/23ac7ee3539419a0900351d5594b36a9
Panic Output
N/A
Expected Behavior
Cloud Function should be deployed consistently
Actual Behavior
Cloud Function gets deployment is flaky.
Half the time it errors out with
Error code 3, message: Failed to retrieve function source code
Steps to Reproduce
terraform apply
Important Factoids
It always works when apply is run again after failure. Some kind of race condition, maybe?
After failure, I can go to the failed cloud function in UI, copy the CF via UI, and deploy with same config and it works.
This seems to indicate that I am not enforcing some explicit dependency or its a bug.
References
The text was updated successfully, but these errors were encountered: