SonarQube 不会向 Discord webhook 发送通知

标签 sonarqube discord webhooks sonarqube-scan

在 sonarqube 中完成每次扫描后,我希望在我的 Discord 应用程序上收到通知。我尝试在 sonarqube webhook 选项中配置我的不和谐 webhook URL,但在扫描代码并且不发送通知后收到 400 错误代码。

我尝试的步骤:

  1. 从我的不和谐 channel 创建了 webhook URL。
  2. sonarqube > Administration > Configuration > Webhooks 中配置该 Webhook URL。
  3. 运行代码扫描,以便向配置的 Webhook 发送通知。

但我遇到了以下错误。

错误:

Last delivery of Spidey Bot

Response: 400
Duration: 186ms
Payload: .....

Discord webohook screenshot attached

SonarQube Error screenshot attached

最佳答案

事实证明,SonarQube 发送到 Discord 的请求正文格式 Not Acceptable 。它会导致错误的请求。以下是来自 Discord 的记录响应,

{ "message": "Cannot send an empty message", "code": 50006 }

要成功发布消息,必须采用记录的特定格式 https://discordapp.com/developers/docs/resources/webhook#execute-webhook

这个问题的解决方案可能是一个中介 URL,它解析请求正文并使用异常的正文参数命中 Discord Webhook。

关于SonarQube 不会向 Discord webhook 发送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56471110/

相关文章:

Discord Js 为具有默认头像的服务器成员提供 null avatarURL

git - 使用 gitlab 自定义接收后 Hook

java - SONAR 提示 Make the enclosure method "static"or remove this set

maven - Jenkins & Sonar : [ERROR] Unable to evict preview database:/batch_bootstrap/evict? 项目=68

java - 可变字段不应为 "public static"

python - 如何在不保存图像的情况下将 PIL Image 对象上传到 Discord 聊天?

python - 删除嵌入后发送另一个嵌入不起作用

java - SonarQube (SonarLint/Sonar-JAVA) 不应使用冗余强制转换

GitHub : I am missing "Settings" menu on the landing page of my repo

stripe-payments - 如何识别 Stripe webhooks 类型?