Skip to content
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

Slack notifier fails to deploy because it doesn't listen to port 8080 #186

Closed
tonicebrian opened this issue Nov 17, 2023 · 7 comments
Closed

Comments

@tonicebrian
Copy link

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?

@rootsher
Copy link

same problem

@rootsher
Copy link

@vicpadilla can you help?

@antonio-cinnamon
Copy link

@vicpadilla I'm also having the same issue.

@EMollusk
Copy link

Same Issue here, has anyone figured out a fix or work around? I've tried using older images, but haven't

@tonicebrian
Copy link
Author

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.

@vicpadilla
Copy link
Member

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.

@tonicebrian
Copy link
Author

tonicebrian commented Jun 5, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants