I am constantly getting this error when I try to deploy my Cloud Function:
Could not create or update Cloud Run service move-docai-to-bigquery, Container Healthcheck failed. Revision 'move-docai-to-bigquery-00012-xuv' is not ready and cannot serve traffic. The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information
It looks like it has a problem with the container instance and its port settings. BUT I do not know how to fix this. Is there anybody who had a similar issue before ?
Hi @andrehilden,
Welcome to Google Cloud Community!
Your Cloud Function deployment fails due to a "Container Healthcheck failed" error.
Cause: The container instance in Cloud Run is unable to start and listen on the defined port (8080).
Steps to Fix:
Additional Tips:
I have the same problem as @andrehilden .I do not understand this answer by @christianpaula . I use
```
gcloud functions deploy python-http-function \
--gen2 \
--runtime=python311 \
--region=australia-southeast1 \
--source=. \
--entry-point=hello_http \
--trigger-http \
--allow-unauthenticated
```
The documentation says that the gcloud deploy functionality takes care of the port. How can I "Ensure my application listens on port 8080 (or adjust the PORT environment variable)." If you mean my local environment, how does that help with the Cloud Console?
Follow up: I tried to set the PORT using os.getenv('PORT', 8080). Then I did gcloud functions deploy again. This time the error was different:
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Could not create or update Cloud Run service python-http-function, Container Healthcheck failed. Revision 'python-http-function-00001-bof' is not ready and cannot serve traffic. The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information.
Do you have any advice?
I had the same error, and it was solved by adding the required dependencies, which I had forgotten to include in the requirements.txt file.
I had the exact same problem, solved it by fixing the requirements.txt
This error is an example of terrible error messaging. You will get this issue if there is a compile error in your code or if there is a missing package in your cloud functions. See this Stack Overflow issue: https://stackoverflow.com/questions/76990628/firebase-functions-could-not-create-or-update-cloud-run...