python - 未找到 POST/405 方法 - 集成聊天机器人时出现 Slack 错误
问题描述
在将我的 rasa 聊天机器人与 slack 集成时,我遇到了某种 405 方法未找到错误。? 请说明这个问题。
\users\shubham\anaconda3\envs\resturantchatbot\lib\site-packages\rasa\core\policies\keras_policy.py:265: FutureWarning: 'KerasPolicy' is deprecated and will be removed in version 2.0. Use 'TEDPolicy' instead.
current_epoch=meta["epochs"],
2020-04-27 02:59:51 INFO rasa.core.policies.ensemble - MappingPolicy not included in policy ensemble. Default intents 'restart and back will not trigger actions 'action_restart' and 'action_back'.
Exception occurred while handling uri: 'http://e8045282.ngrok.io/'
Traceback (most recent call last):
File "c:\users\shubham\anaconda3\envs\resturantchatbot\lib\site-packages\sanic\app.py", line 940, in handle_request
handler, args, kwargs, uri, name = self.router.get(request)
File "c:\users\shubham\anaconda3\envs\resturantchatbot\lib\site-packages\sanic\router.py", line 411, in get
return self._get(request.path, request.method, "")
File "c:\users\shubham\anaconda3\envs\resturantchatbot\lib\site-packages\sanic\router.py", line 452, in _get
raise method_not_supported
sanic.exceptions.MethodNotSupported: Method POST not allowed for URL /
2020-04-27 03:13:47 WARNING rasa.core.channels.slack - Received retry #1 request from slack due to http_timeout.
2020-04-27 03:13:49 ERROR rasa.core.channels.slack - Exception when trying to handle message.The request to the Slack API failed.
The server responded with: {'ok': False, 'error': 'internal_error'}
2020-04-27 03:13:49 ERROR rasa.core.channels.slack - The request to the Slack API failed.
The server responded with: {'ok': False, 'error': 'internal_error'}
Traceback (most recent call last):
File "c:\users\shubham\anaconda3\envs\resturantchatbot\lib\site-packages\rasa\core\channels\slack.py", line 312, in process_message
await on_new_message(user_msg)
File "c:\users\shubham\anaconda3\envs\resturantchatbot\lib\site-packages\rasa\core\channels\channel.py", line 83, in handler
await app.agent.handle_message(*args, **kwargs)
File "c:\users\shubham\anaconda3\envs\resturantchatbot\lib\site-packages\rasa\core\agent.py", line 486, in handle_message
return await processor.handle_message(message)
File "c:\users\shubham\anaconda3\envs\resturantchatbot\lib\site-packages\rasa\core\processor.py", line 107, in handle_message
await self._predict_and_execute_next_action(message.output_channel, tracker)
File "c:\users\shubham\anaconda3\envs\resturantchatbot\lib\site-packages\rasa\core\processor.py", line 538, in _predict_and_execute_next_action
action, tracker, output_channel, self.nlg, policy, confidence
File "c:\users\shubham\anaconda3\envs\resturantchatbot\lib\site-packages\rasa\core\processor.py", line 651, in _run_action
await self._send_bot_messages(events, tracker, output_channel)
File "c:\users\shubham\anaconda3\envs\resturantchatbot\lib\site-packages\rasa\core\processor.py", line 580, in _send_bot_messages
await output_channel.send_response(tracker.sender_id, e.message())
File "c:\users\shubham\anaconda3\envs\resturantchatbot\lib\site-packages\rasa\core\channels\channel.py", line 186, in send_response
await self.send_text_message(recipient_id, message.pop("text"), **message)
File "c:\users\shubham\anaconda3\envs\resturantchatbot\lib\site-packages\rasa\core\channels\slack.py", line 39, in send_text_message
channel=recipient, as_user=True, text=message_part, type="mrkdwn",
File "c:\users\shubham\anaconda3\envs\resturantchatbot\lib\site-packages\slack\web\base_client.py", line 226, in _send
return SlackResponse(**{**data, **res}).validate()
File "c:\users\shubham\anaconda3\envs\resturantchatbot\lib\site-packages\slack\web\slack_response.py", line 176, in validate
raise e.SlackApiError(message=msg, response=self)
slack.errors.SlackApiError: The request to the Slack API failed.
The server responded with: {'ok': False, 'error': 'internal_error'}
这是我在运行 th ngrok 与 slack 集成时遇到的错误。
松弛错误:
HTTP Requests ------------- POST /webhooks/slack/webhook 201 Created POST /webhooks/slack/webhook 200 OK POST /webhooks/slack/webhook 200 OK POST / 405 Method Not Allowed
解决方案
我也面临同样的问题。它是说不允许在'/'(家)上发布。不确定为什么 slack 在“/”(主页)上发布事件请求,它应该在“/webhooks/slack/webhook”上,所以当我使用邮递员发布带有示例消息的 webhook URL 时(https://api.slack.com/events /message)一切顺利。
问题是否已为您解决。
谢谢你,维维克
推荐阅读
- flutter - 如何在 Flutter 中锁定手机屏幕方向?(不在选项卡/ iPad 中)
- javascript - 如何附加到赛普拉斯的窗口
- rust - 期望 HashSet<&'a str> 但找到 HashSet<&&str>
- javascript - 抽屉内容内的 Material UI 可滚动标签
- javascript - 为什么工具提示在我的图表 JS 中出现错误?
- php - 数组json解析
- javascript - 比较对象数组中的日期和时间
- python - 静音 music21 警告
- sql - SQL 仅从带有时间的变量中获取日期 xx/xx/xxxx
- google-cloud-platform - 如何在 BigQuery 中设置自定义分区过期时间