使用 AWS API 网关的自定义 Slack 命令 - 500_service_error
Custom Slack Command with AWS API Gateway - 500_service_error
我将开发一个自定义 Slack 命令,通过 API 网关从 Amazon lambda 返回响应。一切正常,突然间我无法拨打任何电话而不返回
'Darn - that slash command didn't work (error message: `500_service_error`
通过 Curl,响应状态为“200”,我仍然正确接收到我的 lambda 的 json 响应。
- 您是否知道此错误的潜在来源?
- 有什么方法可以为 Slack 调试自定义应用程序吗?
谢谢
这听起来像是您应用中的问题。如果你想测试你的应用程序,你可以在调用命令时模拟 Slack 发送的 POST 请求。
这可以通过简单的 HTML 形式完成,或者如果您想要更高级的东西,请使用 https://www.hurl.it/ or postman。 Hurl 是一个网页,postman 是一个桌面应用程序。两者都允许您向任何 URL 发送自定义 GET 和 POST 请求。 Postman 是更高级的解决方案,允许进行结构化测试。
请参阅下面的示例 POST 来自 Slack 的斜杠命令请求(来自 offical documentatio)。显然,您需要对其进行调整以适合您的配置。
token=gIkuvaNzQIHg97ATvDxqgjtO
team_id=T0001
team_domain=example
enterprise_id=E0001
enterprise_name=Globular%20Construct%20Inc
channel_id=C2147483705
channel_name=test
user_id=U2147483697
user_name=Steve
command=/weather
text=94070
response_url=https://hooks.slack.com/commands/1234/5678
关于你的另一点。如果您想在特定问题上获得具体帮助,您需要 post 您的代码。
我已经与 Slack 团队讨论过可以为您检查他们的内部日志:
"Unfortunately we don't have a debug console available for developers
just yet"
"I can confirm that Slack is receiving a 500 server error when
connecting to your Slash command endpoint. Unfortunately I don't
really have any more information from our end"
真正的问题是在 API 网关级别将调用主体从形式转换为 json。 Slack 正在发送一个必须在 json 中转换为 lamda 的表单主体。我正在关注这个话题 https://forums.aws.amazon.com/thread.jspa?messageID=673012&tstart=0#673012:
- 但根据 Slack 发送的信息,它有时可能会因某些参数字符而中断
- 我已经更新了 AWS 模板来修复我的 API 网关问题 https://gist.github.com/vpasquier/ecded1546c0b736ecf4a5670b4328269
将来最好有 Slack 功能的日志,有 JSON 有效负载而不是表单,同时直接为 API 网关启用 Cloudwatch 日志为了检查随机错误:)
谢谢
我将开发一个自定义 Slack 命令,通过 API 网关从 Amazon lambda 返回响应。一切正常,突然间我无法拨打任何电话而不返回
'Darn - that slash command didn't work (error message: `500_service_error`
通过 Curl,响应状态为“200”,我仍然正确接收到我的 lambda 的 json 响应。
- 您是否知道此错误的潜在来源?
- 有什么方法可以为 Slack 调试自定义应用程序吗?
谢谢
这听起来像是您应用中的问题。如果你想测试你的应用程序,你可以在调用命令时模拟 Slack 发送的 POST 请求。
这可以通过简单的 HTML 形式完成,或者如果您想要更高级的东西,请使用 https://www.hurl.it/ or postman。 Hurl 是一个网页,postman 是一个桌面应用程序。两者都允许您向任何 URL 发送自定义 GET 和 POST 请求。 Postman 是更高级的解决方案,允许进行结构化测试。
请参阅下面的示例 POST 来自 Slack 的斜杠命令请求(来自 offical documentatio)。显然,您需要对其进行调整以适合您的配置。
token=gIkuvaNzQIHg97ATvDxqgjtO
team_id=T0001
team_domain=example
enterprise_id=E0001
enterprise_name=Globular%20Construct%20Inc
channel_id=C2147483705
channel_name=test
user_id=U2147483697
user_name=Steve
command=/weather
text=94070
response_url=https://hooks.slack.com/commands/1234/5678
关于你的另一点。如果您想在特定问题上获得具体帮助,您需要 post 您的代码。
我已经与 Slack 团队讨论过可以为您检查他们的内部日志:
"Unfortunately we don't have a debug console available for developers just yet"
"I can confirm that Slack is receiving a 500 server error when connecting to your Slash command endpoint. Unfortunately I don't really have any more information from our end"
真正的问题是在 API 网关级别将调用主体从形式转换为 json。 Slack 正在发送一个必须在 json 中转换为 lamda 的表单主体。我正在关注这个话题 https://forums.aws.amazon.com/thread.jspa?messageID=673012&tstart=0#673012:
- 但根据 Slack 发送的信息,它有时可能会因某些参数字符而中断
- 我已经更新了 AWS 模板来修复我的 API 网关问题 https://gist.github.com/vpasquier/ecded1546c0b736ecf4a5670b4328269
将来最好有 Slack 功能的日志,有 JSON 有效负载而不是表单,同时直接为 API 网关启用 Cloudwatch 日志为了检查随机错误:)
谢谢