【问题标题】:SonarQube doesn't send notification to Discord webhookSonarQube 不会向 Discord webhook 发送通知
【发布时间】:2019-10-21 14:11:09
【问题描述】:

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

我尝试过的步骤:

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

但我遇到了错误。

Error

Last delivery of Spidey Bot

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

Discord webohook screenshot attached

SonarQube Error screenshot attached

【问题讨论】:

  • 400 响应指的是bad request,因此,正在发送的有效负载的格式可能在某种程度上是无效的。

标签: sonarqube discord webhooks sonarqube-scan


【解决方案1】:

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

{ "message": "不能发送空消息", “代码”:50006 }

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

解决方案可能是一个中介 URL,它解析请求正文并使用例外正文参数命中 Discord Webhook。

【讨论】:

    猜你喜欢
    • 2020-04-11
    • 2018-01-23
    • 2020-11-26
    • 1970-01-01
    • 2018-09-11
    • 2020-03-20
    • 2015-09-27
    • 1970-01-01
    • 2019-03-05
    相关资源
    最近更新 更多