cloud-build-notifiers
cloud-build-notifiers copied to clipboard
Slack notifier fails to deploy because it doesn't listen to port 8080
I'm following steps in https://cloud.google.com/build/docs/configuring-notifications/configure-slack but on step 9, when I run the command:
gcloud run deploy slack-notifier \
--image=us-east1-docker.pkg.dev/gcb-release/cloud-build-notifiers/slack:latest \
--no-allow-unauthenticated \
--update-env-vars=CONFIG_PATH=gs://******/slack/configuration.yaml,PROJECT_ID=******
(hiding my own project id in the example above)
it fails to deploy because it says that the container is not listening in port 8080. This is the message I get:
Deploying container to Cloud Run service [slack-notifier-v1] in project [******] region [europe-southwest1]
⠧ Deploying new service... Revision 'slack-notifier-v1-00001-lr2' 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 envi
ronment variable. Logs for this revision might contain more information.
⠶ Routing traffic...
Logs URL: https://console.cloud.google.com/logs/viewer?project=******&resource=cloud_run_revision/service_name/slack-notifier
-v1/revision_name/slack-notifier-v1-00001-lr2&advancedFilter=resource.type%3D%22cloud_run_revision%22%0Aresource.labels.service_name%3D%22slack-notifier-v1%22%0Aresource.labels.revision_name%3D%22slack-notifier
-v1-00001-lr2%22
X Deploying new service... Revision 'slack-notifier-v1-00001-lr2' 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 envi
ronment variable. Logs for this revision might contain more information.
X Routing traffic... Revision 'slack-notifier-v1-00001-lr2' 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 environm
Logs URL: https://console.cloud.google.com/logs/viewer?project=******&resource=cloud_run_revision/service_name/slack-notifier
-v1/revision_name/slack-notifier-v1-00001-lr2&advancedFilter=resource.type%3D%22cloud_run_revision%22%0Aresource.labels.service_name%3D%22slack-notifier-v1%22%0Aresource.labels.revision_name%3D%22slack-notifier
-v1-00001-lr2%22
For more troubleshooting guidance, see https://cloud.google.com/run/docs/troubleshooting#container-failed-to-startabels.service_name%3D%22slack-notifier-v1%22%0Aresource.labels.revision_name%3D%22slack-notifier
-v1-00001-lr2%22
For more troubleshooting guidance, see https://cloud.google.com/run/docs/troubleshooting#container-failed-to-start
Deployment failed
ERROR: (gcloud.run.deploy) Revision 'slack-notifier-v1-00001-lr2' 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.
Could it be that current image is broken?
same problem
@vicpadilla can you help?
@vicpadilla I'm also having the same issue.
Same Issue here, has anyone figured out a fix or work around? I've tried using older images, but haven't
Same Issue here, has anyone figured out a fix or work around? I've tried using older images, but haven't
It seems like the requirement for the 8080 came without fixing the code. I don't know Go but it seems like there is no part in the code that asks for port 8080.
My idea is to ask ChatGPT to translate that Go code into Python and fix what's missing. If someone tries this path let know. Too busy at the moment.
Normally, this error shows up when the provided config yaml is incorrect and the notifier fails to start. You can find more details by going to the Cloud Run page (https://console.cloud.google.com/run) and accessing the container logs.
One possible misconfiguration is that the json template file is not present in GCS. The provided yaml example specifies such file as uri: gs://example-gcs-bucket/slack.json
, but there is no specific instruction to upload that JSON file to GCS. You can take the example slack.json file from the link in the documentation and upload it to the correct bucket using the cloud console page, or the gsutil CLI.
If it fails after that fix, please provide some details from the container logs.
@vicpadilla with your hint I discovered that logs are complaining about:
fatal error: failed to call SetUp on notifier: failed to find Secret for ref "slack-cloudbuild-webhook": failed to find Secret with reference name "slack-cloudbuild-webhook" in the given secret list"
So you were right, a typo in the config yaml but the error message was confusing for me.
Thanks