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

Message too long for Discord #194

Open
zackchadwick opened this issue Feb 20, 2023 · 3 comments
Open

Message too long for Discord #194

zackchadwick opened this issue Feb 20, 2023 · 3 comments

Comments

@zackchadwick
Copy link

Describe the bug
Discord webhooks have a 1024 character limit for the value field. The current implementation exceeds this causing notifications to Discord to fail.

Messages sent to Discord need to be split into multiple 1024-character messages.

Reference:
https://birdie0.github.io/discord-webhooks-guide/other/field_limits.html
https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure

To Reproduce
Cause a CrashLoopBackOff on a pod that is within the monitoring scope of kwatch.

Expected behavior
A notification successfully sent to Discord via the configured webhook.

Actual behavior
Error is logged within kwatch in regards to a failed notification due to exceeding the 1024 character limit.

level=error msg="failed to send event with Discord: HTTP 400 Bad Request, {\"code\": 50035, \"errors\": {\"embeds\": {\"0\": {\"fields\": {\"6\": {\"value\": {\"_errors\": [{\"code\": \"BASE_TYPE_MAX_LENGTH\", \"message\": \"Must be 1024 or fewer in length.\"}]}}}}}}, \"message\": \"Invalid Form Body\"}"

Version/Commit
0.8.0

@Zenteno
Copy link

Zenteno commented Jun 7, 2023

This problem also happens on telegram

time="2023-06-06T22:40:42Z" level=error msg="failed to send event with Telegram: call to telegram alert returned status code 413"

@dunglavmo
Copy link

same issue!

@willyfransca
Copy link

you manual update the code for limit the character to 1000 character
path: alertmanager/discord/discord.go
the souce code like this
image

this worked for me
thank

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

4 participants