Fail to execute joke action - Rasa Open Source - Rasa Community Forum
post by Alvin on Jun 5, 2021
It shows errors when I am type the user input with "tell me a joke". The actions shows failed as below.
Your input → tell me a joke
2021-06-05 17:21:03 ERROR rasa.core.actions.action - Failed to run custom action ‘action_joke’. Couldn’t connect to the server at ‘https://localhost:5055/webhook’. Is the server running? Error: Cannot connect to host localhost:5055 ssl:default [[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1076)] 2021-06-05 17:21:03 ERROR rasa.core.processor - Encountered an exception while running action ‘action_joke’. Bot will continue, but the actions events are lost. Please check the logs of your action server for more information. Traceback (most recent call last): File “c:\users\user\anaconda3\envs\installingrasa\lib\site-packages\aiohttp\connector.py”, line 969, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) # type: ignore # noqa File “c:\users\user\anaconda3\envs\installingrasa\lib\asyncio\base_events.py”, line 985, in create_connection ssl_handshake_timeout=ssl_handshake_timeout)
... (truncated for brevity)
During handling of the above exception, another exception occurred: Traceback (most recent call last): ... (truncated for brevity) rasa.shared.exceptions.RasaException: Failed to execute custom action.
When I run the “rasa run actions”. It is fine as below:
Here is my joke action code:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import requests
import json
from rasa_sdk import Action
logger = logging.getLogger(__name__)
class ActionRandom(Action):
def name(self):
# define the name of the action which can then be included in training stories
return "action_joke"
def run(self, dispatcher, tracker, domain):
request = json.loads(requests.get("http://api.icndb.com/jokes/random").text)
joke = request["value"]["joke"] # extract a joke from returned json response
dispatcher.utter_message(joke) # send the message back to the user
return []
How do I solve this?
post by earroyoh on Jun 5, 2021
It seems that your endpoints.yml file points to https instead of http actions server. If you want to use https indeed, add certificate parameters in rasa run actions command.
post by Alvin on Jun 5, 2021
Thanks. It works!!