Fail to execute joke action

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\”, 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\”, line 985, in create_connection ssl_handshake_timeout=ssl_handshake_timeout) File “c:\users\user\anaconda3\envs\installingrasa\lib\asyncio\”, line 1013, in _create_connection_transport await waiter File “c:\users\user\anaconda3\envs\installingrasa\lib\asyncio\”, line 530, in data_received ssldata, appdata = self._sslpipe.feed_ssldata(data) File “c:\users\user\anaconda3\envs\installingrasa\lib\asyncio\”, line 189, in feed_ssldata self._sslobj.do_handshake() File “c:\users\user\anaconda3\envs\installingrasa\lib\”, line 774, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1076)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File “c:\users\user\anaconda3\envs\installingrasa\lib\site-packages\rasa\core\actions\”, line 689, in run json=json_body, method=“post”, timeout=DEFAULT_REQUEST_TIMEOUT File “c:\users\user\anaconda3\envs\installingrasa\lib\site-packages\rasa\utils\”, line 151, in request **kwargs, File “c:\users\user\anaconda3\envs\installingrasa\lib\site-packages\aiohttp\”, line 1117, in aenter self._resp = await self._coro File “c:\users\user\anaconda3\envs\installingrasa\lib\site-packages\aiohttp\”, line 521, in _request req, traces=traces, timeout=real_timeout File “c:\users\user\anaconda3\envs\installingrasa\lib\site-packages\aiohttp\”, line 535, in connect proto = await self._create_connection(req, traces, timeout) File “c:\users\user\anaconda3\envs\installingrasa\lib\site-packages\aiohttp\”, line 892, in _create_connection _, proto = await self._create_direct_connection(req, traces, timeout) File “c:\users\user\anaconda3\envs\installingrasa\lib\site-packages\aiohttp\”, line 1051, in _create_direct_connection raise last_exc File “c:\users\user\anaconda3\envs\installingrasa\lib\site-packages\aiohttp\”, line 1032, in _create_direct_connection client_error=client_error, File “c:\users\user\anaconda3\envs\installingrasa\lib\site-packages\aiohttp\”, line 973, in _wrap_create_connection raise ClientConnectorSSLError(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorSSLError: Cannot connect to host localhost:5055 ssl:default [[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1076)]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “c:\users\user\anaconda3\envs\installingrasa\lib\site-packages\rasa\core\”, line 773, in _run_action output_channel, nlg, temporary_tracker, self.domain File “c:\users\user\anaconda3\envs\installingrasa\lib\site-packages\rasa\core\actions\”, line 720, in run raise RasaException(“Failed to execute custom action.”) 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):

    with actions.tracing.extract_start_span(tracer, domain["headers"],

        request = json.loads(requests.get("").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?

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.

1 Like

Thanks. It works!!

1 Like