You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Created a file with https://hooks.slack.com/services/REDACTED in it (no new line)
Created a docker secret from the file
Mounted the secret onto the alertmanager container
set slack_api_url_file: '/my-created-secret'
What did you expect to see?
I expected alertmanager to read the URL from the file and use it to send slack alerts
What did you see instead? Under which circumstances?
Kept failing with
caller=notify.go:732 level=warn component=dispatcher receiver=slack-notifications integration=slack[0] msg="Notify attempt failed, will retry later" attempts=1 err="parse \"<redacted>\": net/url: invalid control character in URL"
Going into the container and doing cat -e /my-created-secret shows https://hooks.slack.com/services/REDACTED$. I think a new-line character is being added when the docker secret is created and alertmanager is failing to strip it out
Environment
Docker
System information:
Linux 4.15.0-175-generic x86_64
Alertmanager version:
alertmanager, version 0.24.0 (branch: HEAD, revision: f484b17)
build user: root@265f14f5c6fc
build date: 20220325-09:31:33
go version: go1.17.8
platform: linux/amd64
Alertmanager configuration file:
global:
slack_api_url_file: '/my-created-secret'
route:
receiver: 'slack-notifications'
receivers:
- name: 'slack-notifications'
slack_configs:
- channel: '#dev-ops'
send_resolved: true
icon_url: 'https://avatars3.githubusercontent.com/u/3380462'
title: |-
[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .CommonLabels.alertname }}
text: >-
{{ range .Alerts -}}
*Alert:* {{ .Annotations.title }}{{ if .Labels.severity }} - `{{ .Labels.severity }}`{{ end }}
*Description:* {{ .Annotations.description }}
{{ end }}
Logs:
ts=2022-04-20T23:24:39.254Z caller=dispatch.go:354 level=error component=dispatcher msg="Notify for alerts failed" num_alerts=2 err="slack-notifications/slack[0]: notify retry canceled after 17 attempts: parse \"<redacted>\": net/url: invalid control character in URL"
ts=2022-04-20T23:24:39.256Z caller=notify.go:732 level=warn component=dispatcher receiver=slack-notifications integration=slack[0] msg="Notify attempt failed, will retry later" attempts=1 err="parse \"<redacted>\": net/url: invalid control character in URL"
ts=2022-04-20T23:29:39.256Z caller=dispatch.go:354 level=error component=dispatcher msg="Notify for alerts failed" num_alerts=2 err="slack-notifications/slack[0]: notify retry canceled after 16 attempts: parse \"<redacted>\": net/url: invalid control character in URL"
ts=2022-04-20T23:29:39.259Z caller=notify.go:732 level=warn component=dispatcher receiver=slack-notifications integration=slack[0] msg="Notify attempt failed, will retry later" attempts=1 err="parse \"<redacted>\": net/url: invalid control character in URL"
The text was updated successfully, but these errors were encountered:
It did work for me, although I had to explicitly strip the invisible newline character from the file before creating the secret. Specifying not to write a newline can be done with commands such as echo -n http://api-url > secret_file.txt, but some text editors may have an option to show invisible characters.
What did you do?
https://hooks.slack.com/services/REDACTED
in it (no new line)slack_api_url_file: '/my-created-secret'
What did you expect to see?
I expected alertmanager to read the URL from the file and use it to send slack alerts
What did you see instead? Under which circumstances?
Kept failing with
Going into the container and doing
cat -e /my-created-secret
showshttps://hooks.slack.com/services/REDACTED$
. I think a new-line character is being added when the docker secret is created and alertmanager is failing to strip it outEnvironment
Docker
System information:
Linux 4.15.0-175-generic x86_64
Alertmanager version:
alertmanager, version 0.24.0 (branch: HEAD, revision: f484b17)
build user: root@265f14f5c6fc
build date: 20220325-09:31:33
go version: go1.17.8
platform: linux/amd64
The text was updated successfully, but these errors were encountered: