alertmanager icon indicating copy to clipboard operation
alertmanager copied to clipboard

Notifier for HipChat broken in Alertmanager 0.15.1

Open andrekully opened this issue 8 years ago • 2 comments

What did you do? running AM v0.15.1 to test

What did you expect to see? The request URL towards HipChat server (on premise) as in 0.15.0: POST /v2/room/0000/notification?auth_token=xxxxxxxxxXXXXXXXXXXxxxxxxxxxXXXXXXXXXXXX HTTP/1.1

What did you see instead? Under which circumstances? Request in 0.15.1: POST /v2/room/0000/notification%3Fauth_token=xxxxxxxxxXXXXXXXXXXxxxxxxxxxXXXXXXXXXXXX HTTP/1.1 -->> which results in a HTTP 404 response code from HipChat server

it seems that this behaviour is caused by changing the url typed as string to url.URL

changing as follows in notify/impl.go did fix the issue

-       apiURL.Path += fmt.Sprintf("v2/room/%s/notification?auth_token=%s", roomid, n.conf.AuthToken)
+       apiURL.Path += fmt.Sprintf("v2/room/%s/notification", roomid)
+       q := apiURL.Query()
+       q.Set("auth_token", fmt.Sprintf("%s", n.conf.AuthToken))
+       apiURL.RawQuery = q.Encode()

andrekully avatar Aug 13 '18 07:08 andrekully

@simonpasquier Looks like the ? introducing the query string is being escaped as part of the Path

stuartnelson3 avatar Aug 13 '18 10:08 stuartnelson3

Thanks a lot @andrekully for the detailed bug report!

The new release contains the fix: https://github.com/prometheus/alertmanager/releases/tag/v0.15.2

mxinden avatar Aug 14 '18 11:08 mxinden