找不到POST / 405方法-集成chatbot时出现松弛错误

时间:2020-04-27 10:22:51

标签: python post slack-api rasa-nlu rasa

在将我的rasa chatbot与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'}

这是我在运行带有松弛的ngrok集成时遇到的错误。
松弛错误:

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

1 个答案:

答案 0 :(得分:0)

我也面临着同样的问题。就是说不允许在“ /”(主页)上发布。不知道为什么slack在'/'(home)上发布事件请求,为什么应该在'/ webhooks / slack / webhook'上发布事件请求,所以当我使用邮递员在示例消息(https://api.slack.com/events/message)上发布webhook URL时,一切正常。 / p>

enter image description here

问题是否已为您解决?

谢谢, 维维克