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

Unable to post messages when in deployment #1285

Closed
isidhux opened this issue Apr 29, 2024 · 4 comments
Closed

Unable to post messages when in deployment #1285

isidhux opened this issue Apr 29, 2024 · 4 comments
Labels
feedback given When a review has been conducted and awaiting the response from the comitter(s) stale

Comments

@isidhux
Copy link

isidhux commented Apr 29, 2024

What happened

I am integrating slack with an application. while running code with 'go test', everything is working fine, but once i deploy the app in docker container after generating a build, it is throwing the following error:

"Post "https://slack.com/api/chat.postMessage\": tls: failed to verify certificate: x509: certificate signed by unknown authority"

Expected behavior

It should send the messages

Steps to reproduce

generate a build and run the binary in ubuntu:latest docker container
i am using docker compose to run the app and redis container
use the code from slack-go tutorial https://medium.com/@wambuirebeka/how-to-integrate-slack-notifications-using-golang-84451aca27e3#:~:text=New()%20New%20builds%20a,the%20provided%20token%20and%20options.&text=Our%20func%20sendSlackMessage%20takes%20in,a%20message%20to%20a%20channel.

reproducible code

type Slack struct {
SlackClient *slack.Client
ChannelID string
}

func (s *Slack) SendSlackMessage(message string) error {
ChannelID, timestamp, err := s.SlackClient.PostMessage(s.ChannelID, slack.MsgOptionText(message, false))
if err != nil {
return err
}
fmt.Printf("Message sent successfully to %s channel at %s\n", ChannelID, timestamp)
return nil
}

slackObj := &Slack{
SlackClient: slack.New("token-string"),
ChannelID: "channel-id",
}
if err := slackObj.SendSlackMessage("Vcenter Sync Failed"); err != nil {
t.Fatalf("Error occured while sending slack msg: %v \n", err)
}

Versions

  • Go: go1.21.5 linux/amd64
  • slack-go/slack: 0.12.5
@isidhux
Copy link
Author

isidhux commented Apr 29, 2024

executes without problem in host machine, but gives problem when deployed to container

@lorenzoaiello
Copy link
Contributor

Hi @isidhux , please make sure that your docker container has the latest ca-certificates installed (especially if using scratch). If this recently started happening it may be related to the Let's Encrypt Certificate Chain change.

@lorenzoaiello lorenzoaiello added the feedback given When a review has been conducted and awaiting the response from the comitter(s) label Jul 14, 2024
Copy link

github-actions bot commented Sep 2, 2024

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the stale label Sep 2, 2024
Copy link

github-actions bot commented Sep 9, 2024

This issue was closed because it has been stalled for 10 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback given When a review has been conducted and awaiting the response from the comitter(s) stale
Projects
None yet
Development

No branches or pull requests

2 participants