Exception: No registered Action found for name 'action_testAction'

I recently started trying out rasa. I am trying to build a chatbot that will filter results from a sqlite database and return it to the user when a question is asked. To do this, I wrote a custom action and specified an endpoint. I started the action_server and in a new terminal, ran the rasa shell with the endpoint specified

rasa shell --endpoints endpoints.yml

This is the code I used to run the action server

python -m rasa_sdk --actions actions

but when the question is asked to the bot, it just prompts me for the next input and returns an exception

rasa.core.processor  - Encountered an exception while running action 'action_testAction'. Bot will continue, but the actions events are lost. Please check the logs of your action server for more information

In the action_server terminal window, I get the following error

Exception: No registered Action found for name 'action_testAction'.

this is my endpoint.yml file

    url: "http://localhost:5055/webhook"

this is my actions.py file

from typing import Any, Text, Dict, List
from rasa_core_sdk import Action, Tracker
import sqlite3

class TestAction(Action):

    def name(self) -> Text:
        return "action_testAction"

    def run(self, dispatcher, tracker, domain):

        UserId = tracker.get_slot('UserID')
        query = 'SELECT User_name FROM sales WHERE UserID=?'

        conn = sqlite3.connect("test.db")
        cursor = conn.cursor()
        cursor.execute(query, (UserId,))
        name = cursor.fetchall()

        msg = 'Hello {}!'.format(name)

Not sure what I am doing wrong

Please help

Did you include the action in the domain file?

Edit: Ah, and did you know about python’s f-strings? Relatively new feature

Simpler and easier readable than .format(…)

yes. I added the action to the domain file. I will start using f-strings

Run the action server like this

rasa run actions -vv

And see if you can find more helpful error output in the debug log

I got this error message in the beginning. but the server ran.

2019-09-09 15:11:03 DEBUG    rasa.cli.utils  - 'actions.py' not found. Using default location 'actions' instead.

But as for the chatbot’s response itself, I get the exact same error message.

Exception: No registered Action found for name 'action_testAction'.

These are all the actions in the domain.yml file

- utter_greet
- utter_goodbye
- utter_question
- utter_askUserId
- action_testAction

Well, the output says, that it cannot find the file.

What’s your file structure? For a default setup try

rasa init 

in an empty directory. You see how its supposed to look like. Maybe just copy your actions there and try to make it run from there.

I created a new directory, ran rasa init and pasted the following files from the old directory.

  1. actions.py
  2. endpoint.yml
  3. config.yml
  4. domain.yml
  5. data/nlu.md
  6. data/stories.md

then, I trained the model again with rasa train. started the actions server, and ran the chatbot with rasa shell --endpoints endpoints.yml.

Facing the same problem

I upgraded the rasa library to 1.2.7. and triggered the actions server with the following code from the folder where the actions.py file is located.

rasa run actions --actions actions -vv

Now the actions work when called by the chatbot.