-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix: Mattermost 400 BAD request error #2902
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
Fix: Mattermost 400 BAD request error #2902
Conversation
ref: alerts.py / MattermostAlerter.populate_fields
explicitly mentions field strcture with fallbacks
bbe2040 to
a502de8
Compare
alert:
- "mattermost"
mattermost_webhook_url: "https://...."
mattermost_username_override: ....
mattermost_icon_url_override: ....
mattermost_msg_fields:
- title: Stack
value: "{0} {1}" # interpolate fields mentioned in args
short: false
args: ["type", "msg.status_code"] # fields from doc
- title: Name
value: static field
short: falseThis example must be added to doc |
e14bbb8 to
378d471
Compare
|
Can confirm, this PR worked for me! Thanks @junaid1460 👍 🔥 Great work 🚀 LGTM |
|
Have you checked the operation after changing the code? |
I have not updated this to work with latest versions, as of now closing this PR |
|
I got an error even before your change. If you delete the following mattermost_msg_fields from schema.yaml, there seems to be no problem. mattermostField: &mattermostField
type: object
additionalProperties: false
properties:
title: {type: string}
value: {type: string}
args: *arrayOfString
short: {type: boolean}mattermost_msg_fields: *mattermostField |
|
It seems to be a bug since the alert notification to mattermost was added. Perhaps neither the person who made the pull request nor the person who reviewed and merged it was confirmed to work. |
|
It seems that there is no problem if you modify schema.yaml as follows. mattermostField: &mattermostField
type: object
additionalProperties: false
properties:
title: {type: string}
value: {type: string}
args: *arrayOfString
short: {type: boolean}
arrayOfMattermostFields: &arrayOfMattermostField
type: array
items: *mattermostField mattermost_msg_fields: *arrayOfMattermostField |
Description
Fixes mattermost 400 bad request due to data type mismatch caused by schema mismatch and adds missing text field to payload.
Type of change
Test Configuration:
Checklist: