abahmed / kwatch

:eyes: monitor & detect crashes in your Kubernetes(K8s) cluster instantly
https://kwatch.dev
MIT License
959 stars 75 forks source link

Message too long for Discord #194

Open zackchadwick opened 1 year ago

zackchadwick commented 1 year ago

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 commented 1 year ago

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 commented 11 months ago

same issue!