Rasa run actions no work

Rasa demo used to work normally, but today rasa action can’t work normally

I found that the action server could not be started

Please help me

@father-liang Hi Firstly you need to update the topic, as Rasa action server not running in docker container as root.

Well as I can see your error screenshot, you are trying to run the rasa action server inside docker container, can I asked why you following this approach and do you have docker-compose file or dockerfile?

This is my dockerfile

This is the “start” file

image

Hi @nik202 I am facing this issue when I hit rasa run actions.Actually I am using azure instance where I have the Rasa OSS (folder).And When I run the command then it shows this.

(venv) Rishabh@instance-1:~/chatbot/actions$ rasa run actions
    2021-08-10 09:49:14 INFO     rasa_sdk.endpoint  - Starting action endpoint server...
    Traceback (most recent call last):
      File "/home/Rishabh/venv/bin/rasa", line 8, in <module>
    sys.exit(main())
      File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/__main__.py", line 117, in main
    cmdline_arguments.func(cmdline_arguments)
      File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/cli/run.py", line 59, in run_actions
    sdk.main_from_args(args)
      File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa_sdk/__main__.py", line 18, in main_from_args
    run(
      File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa_sdk/endpoint.py", line 138, in run
    app = create_app(
      File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa_sdk/endpoint.py", line 82, in create_app
    executor.register_package(action_package_name)
      File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa_sdk/executor.py", line 262, in register_package
    self._import_submodules(package)
      File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa_sdk/executor.py", line 218, in _import_submodules
    package = self._import_module(package)
      File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa_sdk/executor.py", line 239, in _import_module
    module = importlib.import_module(name)
      File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
      File "<frozen importlib._bootstrap>", line 991, in _find_and_load
      File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 844, in exec_module
      File "<frozen importlib._bootstrap_external>", line 981, in get_code
      File "<frozen importlib._bootstrap_external>", line 911, in source_to_code
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "/home/Rishabh/chatbot/actions/actions.py", line 10
    from typing import Any, Text, Dict, List
    ^
    IndentationError: unexpected indent
    ``

@Rishabhh17 In line 10 you have error try delete the space or do proper indentation for from typing import Any, Text, Dict, List

@nik202 I have mentioned the endpoints url: http://34.125.201.400:5055/webhook Then run the rasa shell command in the terminal,then this happens.

    Bot loaded. Type a message and press enter (use '/stop' to exit):
    Your input ->  Hi
    Hey! How are you?
    Your input ->  Tell me the weather forcast
    Which city you want to check for?
    Your input ->  Dubai
    2021-08-10 11:37:57 ERROR    rasa.core.processor  - Encountered an exception whi                                                                                        le running action 'action_weather_api'.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 "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/core/processor.py",                                                                                         line 772, in _run_action
        events = await action.run(
      File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/core/actions/action.                                                                                        py", line 672, in run
        raise RasaException(
    rasa.shared.exceptions.RasaException: Failed to execute custom action 'action_we                                                                                        ather_api' because no endpoint is configured to run this custom action.

Please take a look at the docs and set an endpoint configuration via the --endpoints fla g. Custom Actions

@Rishabhh17 This is related to above mentioned issue or error?

Yes

Any guidance?

@Rishabhh17 Share complete error or formatted correctly It have space and blank between please see. I can’t read.

I want to fetch the weather information using OpenWeatherApi .When I give the Location instead of starting the action server it shows this error. And I have already mentioned the action endpoint url but after the (rasa run actions) it shows server is up and running on (http://0.0.0.0:5055).

Your input ->  Hi
Hey! How are you?
Your input ->  What is the weather today
Which city you want to check for?
Your input ->  Dubai
2021-08-10 12:49:24 ERROR    asyncio  - Task exception was never retrieved
future: <Task finished name='Task-2' coro=<configure_app.<locals>.run_cmdline_io() done, defined at /home/Rishabh/venv/lib/python3.8/site-packages/rasa/core/run.py:131> exception=TimeoutError()>
Traceback (most recent call last):
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/core/run.py", line 135, in run_cmdline_io
    await console.record_messages(
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/core/channels/console.py", line 182, in record_messages
    async for response in bot_responses:
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/core/channels/console.py", line 137, in _send_message_receive_stream
    async for line in resp.content:
  File "/home/Rishabh/venv/lib/python3.8/site-packages/aiohttp/streams.py", line 39, in __anext__
    rv = await self.read_func()
  File "/home/Rishabh/venv/lib/python3.8/site-packages/aiohttp/streams.py", line 338, in readline
    await self._wait("readline")
  File "/home/Rishabh/venv/lib/python3.8/site-packages/aiohttp/streams.py", line 306, in _wait
    await waiter
  File "/home/Rishabh/venv/lib/python3.8/site-packages/aiohttp/helpers.py", line 656, in __exit__
    raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError
2021-08-10 12:51:24 ERROR    rasa.core.actions.action  - Failed to run custom action 'action_weather_api'. Couldn't connect to the server at 'http://34.125.200.140:5055/webhook'. Is the server running? Error: Cannot connect to host 34.125.200.140:5055 ssl:default [Connection timed out]
2021-08-10 12:51:24 ERROR    rasa.core.processor  - Encountered an exception while running action 'action_weather_api'.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 "/home/Rishabh/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 969, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore  # noqa
  File "uvloop/loop.pyx", line 1974, in create_connection
  File "uvloop/loop.pyx", line 1951, in uvloop.loop.Loop.create_connection
TimeoutError: [Errno 110] Connection timed out

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

Traceback (most recent call last):
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/core/actions/action.py", line 685, in run
    response = await self.action_endpoint.request(
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/utils/endpoints.py", line 163, in request
    async with session.request(
  File "/home/Rishabh/venv/lib/python3.8/site-packages/aiohttp/client.py", line 1117, in __aenter__
    self._resp = await self._coro
  File "/home/Rishabh/venv/lib/python3.8/site-packages/aiohttp/client.py", line 520, in _request
    conn = await self._connector.connect(
  File "/home/Rishabh/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 535, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/home/Rishabh/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 892, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/home/Rishabh/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 1051, in _create_direct_connection
    raise last_exc
  File "/home/Rishabh/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 1020, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/home/Rishabh/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 975, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 34.125.200.140:5055 ssl:default [Connection timed out]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/core/processor.py", line 772, in _run_action
    events = await action.run(
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/core/actions/action.py", line 717, in run
    raise RasaException("Failed to execute custom action.")
rasa.shared.exceptions.RasaException: Failed to execute custom action.

@Rishabhh17 Few suggestion based on error:

  1. Check the API_Key and base_url address if you using

  2. If you had created weather.py hope you had import in action.py i.e

from weather import Weather

  1. Hope all the requirements are met related to the code.

  2. Try check the action logs as this error related to action server and you will be able to analyse more.

Here is the screenshot of actions.py and weather.py.

This is when I run (rasa run actions) in one terminal.

    (venv) Rishabh@instance-1:~/chatbot/actions$ rasa run actions
    <frozen importlib._bootstrap>:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject
    <frozen importlib._bootstrap>:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject
    <frozen importlib._bootstrap>:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject
    <frozen importlib._bootstrap>:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject
    2021-08-11 06:59:34 INFO     rasa_sdk.endpoint  - Starting action endpoint server...
    2021-08-11 06:59:34 INFO     rasa_sdk.executor  - Registered function for 'action_weather_api'.
    2021-08-11 06:59:34 INFO     rasa_sdk.endpoint  - Action endpoint is up and running on http://0.0.0.0:5055

When I run (rasa shell) in other terminal and gives an intent to do custom action, then it shows this.

Your input ->  Hi
Hey! How are you?
Your input ->  Weather
Which city you want to check for?
Your input ->  Dubai
2021-08-11 07:00:37 ERROR    rasa.core.actions.action  - Failed to run custom action 'action_weather_api'. Couldn't connect to the server at 'http://34.125.200.140:8080'. Is the server running? Error: Cannot connect to host 34.125.200.140:8080 ssl:default [Connection refused]
2021-08-11 07:00:37 ERROR    rasa.core.processor  - Encountered an exception while running action 'action_weather_api'.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 "/home/Rishabh/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 969, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore  # noqa
  File "uvloop/loop.pyx", line 1974, in create_connection
  File "uvloop/loop.pyx", line 1951, in uvloop.loop.Loop.create_connection
ConnectionRefusedError: [Errno 111] Connection refused

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

Traceback (most recent call last):
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/core/actions/action.py", line 685, in run
    response = await self.action_endpoint.request(
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/utils/endpoints.py", line 163, in request
    async with session.request(
  File "/home/Rishabh/venv/lib/python3.8/site-packages/aiohttp/client.py", line 1117, in __aenter__
    self._resp = await self._coro
  File "/home/Rishabh/venv/lib/python3.8/site-packages/aiohttp/client.py", line 520, in _request
    conn = await self._connector.connect(
  File "/home/Rishabh/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 535, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/home/Rishabh/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 892, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/home/Rishabh/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 1051, in _create_direct_connection
    raise last_exc
  File "/home/Rishabh/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 1020, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/home/Rishabh/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 975, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 34.125.200.140:8080 ssl:default [Connection refused]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/core/processor.py", line 772, in _run_action
    events = await action.run(
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/core/actions/action.py", line 717, in run
    raise RasaException("Failed to execute custom action.")
rasa.shared.exceptions.RasaException: Failed to execute custom action.

@Rishabhh17

Why so many option changes?

before webhook was this http://34.125.201.400:5055/webhook and now this http://34.125.200.140:8080 is this IP ping you back as per request? Try stick with default localhost first and then proceed with other.

change in dispatcher.utter_message(template="utter_temp" , tracker, temp=temp) and check the story

check with rasa interactive or action server logs

@Rishabhh17 next time dont send the screenshot, just send the formatted code.

@Rishabhh17 Delete older trained model and re-train the bot as he is fetching older mention webhook, check the logs carefully.

Still an error

(venv) Rishabh@instance-1:~/chatbot$ rasa train
<frozen importlib._bootstrap>:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject
<frozen importlib._bootstrap>:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject
<frozen importlib._bootstrap>:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject
<frozen importlib._bootstrap>:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject
The configuration for policies and pipeline was chosen automatically. It was written into the config file at 'config.yml'.
Nothing changed. You can use the old model stored at '/home/Rishabh/chatbot/models/20210811-103643.tar.gz'.
(venv) Rishabh@instance-1:~/chatbot$ rasa interactive
<frozen importlib._bootstrap>:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject
<frozen importlib._bootstrap>:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject
<frozen importlib._bootstrap>:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject
<frozen importlib._bootstrap>:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject
The configuration for pipeline and policies was chosen automatically. It was written into the config file at 'config.yml'.
The configuration for pipeline and policies was chosen automatically. It was written into the config file at 'config.yml'.
Nothing changed. You can use the old model stored at '/home/Rishabh/chatbot/models/20210811-103643.tar.gz'.
Traceback (most recent call last):
  File "/home/Rishabh/venv/bin/rasa", line 8, in <module>
    sys.exit(main())
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/__main__.py", line 117, in main
    cmdline_arguments.func(cmdline_arguments)
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/cli/interactive.py", line 90, in interactive
    perform_interactive_learning(args, zipped_model, file_importer)
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/cli/interactive.py", line 124, in perform_interactive_learning
    do_interactive_learning(args, file_importer)
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/core/train.py", line 179, in do_interactive_learning
    interactive.run_interactive_learning(
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/core/training/interactive.py", line 1696, in run_interactive_learning
    endpoints = AvailableEndpoints.read_endpoints(server_args.get("endpoints"))
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/core/utils.py", line 175, in read_endpoints
    action = read_endpoint_config(endpoint_file, endpoint_type="action_endpoint")
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/utils/endpoints.py", line 34, in read_endpoint_config
    return EndpointConfig.from_dict(content[endpoint_type])
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/utils/endpoints.py", line 182, in from_dict
    return EndpointConfig(**data)
TypeError: type object argument after ** must be a mapping, not str

@Rishabhh17 why you only showing one screen error what about action server error?

Other termiinal

(venv) Rishabh@instance-1:~/chatbot/actions$ rasa run actions
<frozen importlib._bootstrap>:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject
<frozen importlib._bootstrap>:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject
<frozen importlib._bootstrap>:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject
<frozen importlib._bootstrap>:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject
2021-08-11 10:58:19 INFO     rasa_sdk.endpoint  - Starting action endpoint server...
Traceback (most recent call last):
  File "/home/Rishabh/venv/bin/rasa", line 8, in <module>
    sys.exit(main())
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/__main__.py", line 117, in main
    cmdline_arguments.func(cmdline_arguments)
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa/cli/run.py", line 59, in run_actions
    sdk.main_from_args(args)
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa_sdk/__main__.py", line 18, in main_from_args
    run(
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa_sdk/endpoint.py", line 138, in run
    app = create_app(
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa_sdk/endpoint.py", line 82, in create_app
    executor.register_package(action_package_name)
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa_sdk/executor.py", line 262, in register_package
    self._import_submodules(package)
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa_sdk/executor.py", line 218, in _import_submodules
    package = self._import_module(package)
  File "/home/Rishabh/venv/lib/python3.8/site-packages/rasa_sdk/executor.py", line 239, in _import_module
    module = importlib.import_module(name)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 844, in exec_module
  File "<frozen importlib._bootstrap_external>", line 981, in get_code
  File "<frozen importlib._bootstrap_external>", line 911, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/Rishabh/chatbot/actions/actions.py", line 25
    dispatcher.utter_message(template="utter_temp",tracker,temp=temp)
                                                   ^
SyntaxError: positional argument follows keyword argument

@Rishabhh17 Rishabh the error is infront of you, see the error. @Rishabhh17 your weather code is giving you output?

No , Actually when I point to the actions folder then (python3 weather.py) from terminal it did nothing.

@Rishabhh17 as expected, then fixed the code, ok share me the code but not screenshot please.