Rasa Custom Actions not working

hey there I have recently been trying to make a bot using rasa and while trying to run the custom actions server, I have seen that the custom actions don’t work, here is the error :

(env) dag@Domenicos-MacBook-Air pre-screening-chatbot-main % rasa run actions
/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/rasa/core/tracker_store.py:876: MovedIn20Warning: Deprecated API features detected! These feature(s) are not compatible with SQLAlchemy 2.0. To prevent incompatible upgrades prior to updating applications, ensure requirements files are pinned to "sqlalchemy<2.0". Set environment variable SQLALCHEMY_WARN_20=1 to show all deprecation warnings.  Set environment variable SQLALCHEMY_SILENCE_UBER_WARNING=1 to silence this message. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
  Base: DeclarativeMeta = declarative_base()
2023-02-21 10:03:11 INFO     rasa_sdk.endpoint  - Starting action endpoint server...
2023-02-21 10:03:11 INFO     rasa_sdk.executor  - Registered function for 'action_empty_slots'.
2023-02-21 10:03:11 INFO     rasa_sdk.executor  - Registered function for 'action_save_name'.
2023-02-21 10:03:11 INFO     rasa_sdk.endpoint  - Action endpoint is up and running on http://0.0.0.0:5055
2023-02-21 10:03:15 ERROR    rasa_sdk.endpoint  - Exception occurred during execution of request <Request: GET />
Traceback (most recent call last):
  File "/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/sanic_routing/router.py", line 79, in resolve
    route, param_basket = self.find_route(
  File "", line 9, in find_route
sanic_routing.exceptions.NotFound: Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/sanic_routing/router.py", line 79, in resolve
    route, param_basket = self.find_route(
  File "", line 9, in find_route
sanic_routing.exceptions.NotFound: Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/sanic/router.py", line 38, in _get
    return self.resolve(
  File "/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/sanic_routing/router.py", line 90, in resolve
    return self.resolve(
  File "/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/sanic_routing/router.py", line 96, in resolve
    raise self.exception(str(e), path=path)
sanic_routing.exceptions.NotFound: Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "handle_request", line 26, in handle_request
    from socket import socket
  File "/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/sanic/router.py", line 66, in get
    return self._get(path, method, host)
  File "/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/sanic/router.py", line 44, in _get
    raise NotFound("Requested URL {} not found".format(e.path))
sanic.exceptions.NotFound: Requested URL  not found

And when I try to run the rasa shell (with the running custom actions server), I get the error :

(env) dag@Domenicos-MacBook-Air pre-screening-chatbot-main % rasa shell
/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/rasa/core/tracker_store.py:876: MovedIn20Warning: Deprecated API features detected! These feature(s) are not compatible with SQLAlchemy 2.0. To prevent incompatible upgrades prior to updating applications, ensure requirements files are pinned to "sqlalchemy<2.0". Set environment variable SQLALCHEMY_WARN_20=1 to show all deprecation warnings.  Set environment variable SQLALCHEMY_SILENCE_UBER_WARNING=1 to silence this message. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
  Base: DeclarativeMeta = declarative_base()
/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/tensorflow/core/framework/tensor_shape_pb2.py:18: DeprecationWarning: Call to deprecated create function FileDescriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
  DESCRIPTOR = _descriptor.FileDescriptor(
/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/tensorflow/core/framework/tensor_shape_pb2.py:36: DeprecationWarning: Call to deprecated create function FieldDescriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
  _descriptor.FieldDescriptor(
/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/tensorflow/core/framework/tensor_shape_pb2.py:29: DeprecationWarning: Call to deprecated create function Descriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
  _TENSORSHAPEPROTO_DIM = _descriptor.Descriptor(
/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/tensorflow/core/framework/types_pb2.py:19: DeprecationWarning: Call to deprecated create function FileDescriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
  DESCRIPTOR = _descriptor.FileDescriptor(
/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/tensorflow/core/framework/types_pb2.py:33: DeprecationWarning: Call to deprecated create function EnumValueDescriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
  _descriptor.EnumValueDescriptor(
/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/tensorflow/core/framework/types_pb2.py:27: DeprecationWarning: Call to deprecated create function EnumDescriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
  _DATATYPE = _descriptor.EnumDescriptor(
/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/tensorflow/core/framework/resource_handle_pb2.py:20: DeprecationWarning: Call to deprecated create function FileDescriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
  DESCRIPTOR = _descriptor.FileDescriptor(
/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/tensorflow/core/framework/resource_handle_pb2.py:39: DeprecationWarning: Call to deprecated create function FieldDescriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
  _descriptor.FieldDescriptor(
/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/tensorflow/core/framework/resource_handle_pb2.py:32: DeprecationWarning: Call to deprecated create function Descriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
  _RESOURCEHANDLEPROTO_DTYPEANDSHAPE = _descriptor.Descriptor(
/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/tensorflow/core/framework/tensor_pb2.py:21: DeprecationWarning: Call to deprecated create function FileDescriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
  DESCRIPTOR = _descriptor.FileDescriptor(
/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/tensorflow/core/framework/tensor_pb2.py:40: DeprecationWarning: Call to deprecated create function FieldDescriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
  _descriptor.FieldDescriptor(
/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/tensorflow/core/framework/tensor_pb2.py:33: DeprecationWarning: Call to deprecated create function Descriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
  _TENSORPROTO = _descriptor.Descriptor(
/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/tensorflow/core/framework/attr_value_pb2.py:21: DeprecationWarning: Call to deprecated create function FileDescriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
  DESCRIPTOR = _descriptor.FileDescriptor(
/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/tensorflow/core/framework/attr_value_pb2.py:40: DeprecationWarning: Call to deprecated create function FieldDescriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
  _descriptor.FieldDescriptor(
/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/tensorflow/core/framework/attr_value_pb2.py:33: DeprecationWarning: Call to deprecated create function Descriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
  _ATTRVALUE_LISTVALUE = _descriptor.Descriptor(
2023-02-21 10:05:04 INFO     root  - Connecting to channel 'cmdline' which was specified by the '--connector' argument. Any other channels will be ignored. To connect to all given channels, omit the '--connector' argument.
2023-02-21 10:05:04 INFO     root  - Starting Rasa server on http://0.0.0.0:5005
2023-02-21 10:05:06 INFO     rasa.core.processor  - Loading model models/20230220-170114-piercing-colby.tar.gz...
2023-02-21 10:05:07 INFO     rasa.nlu.utils.spacy_utils  - Trying to load SpaCy model with name 'it_core_news_lg'.
2023-02-21 10:05:09 INFO     rasa.nlu.utils.spacy_utils  - Trying to load SpaCy model with name 'it_core_news_lg'.
2023-02-21 10:05:46 WARNING  rasa.shared.utils.common  - The UnexpecTED Intent Policy is currently experimental and might change or be removed in the future 🔬 Please share your feedback on it in the forum (https://forum.rasa.com) to help us make this feature ready for production.
2023-02-21 10:05:55 INFO     root  - Rasa server is up and running.
Bot loaded. Type a message and press enter (use '/stop' to exit): 
Your input ->  ciao                                                                                                                                                    
2023-02-21 10:05:59 ERROR    rasa.core.processor  - Encountered an exception while running action 'action_empty_slots'.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 "/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/rasa/core/actions/action.py", line 759, in run
    response: Any = await self.action_endpoint.request(
  File "/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/rasa/utils/endpoints.py", line 173, in request
    raise ClientResponseError(
rasa.utils.endpoints.ClientResponseError: 500, Internal Server Error, body='b'{"error":"Requested URL  not found","request_body":null}''

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

Traceback (most recent call last):
  File "/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/Ciao! Mi dici per favore il tuo nome e cognome?
Your input ->  mi chiamo dodo                                                                                                                                          
rasa/core/processor.py", line 874, in _run_action
    events = await action.run(
  File "/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/rasa/core/actions/action.py", line 783, in run
    raise RasaException(
rasa.shared.exceptions.RasaException: Failed to execute custom action 'action_empty_slots'
--- Logging error ---
2023-02-21 10:06:05 ERROR    rasa.core.processor  - Encountered an exception while running action 'action_save_name'.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 "/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/rasa/core/actions/action.py", line 759, in run
    response: Any = await self.action_endpoint.request(
  File "/Users/dag/Documents/Experis/pre-screening-chatbot-main/env/lib/python3.9/site-packages/rasa/utils/endpoints.py", line 173, in request
    raise Ciao dodo! Qual è il tuo numero di cellulare?
Your input ->                                

I have already uncommented the action_endpoint in the endpoints.yml file and here is my actions.py file :

from typing import Any, Text, Dict, List

from rasa_sdk import Action, Tracker
from rasa_sdk.events import SlotSet
from database_connectivity import DataUpdate
from database_connectivity import *
from rasa_sdk.executor import CollectingDispatcher


class EmptySlots(Action):

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

    def run(self, dispatcher, tracker, domain):
        print("Removing previous slots...")
        dispatcher.utter_message("Inside Empty Slots")
        return [SlotSet("person_name", ""), SlotSet("cell_number", ""), SlotSet("ral_number", ""),
                SlotSet("day_fixed", ""), SlotSet("time_fixed", "")]


class SaveName(Action):

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

    def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
        dispatcher.utter_message("Save name action executed")
        print("Save name action executed")
        DataUpdate(tracker.get_slot("person_name"), dispatcher=dispatcher)
        #dispatcher.utter_message("Thanks for the valuable feedback. ")
        return []

and here is the DataUpdate Function :

import mysql.connector import pymysql

def DataUpdate(FirstName, dispatcher): dispatcher.utter_message(“Inside DataUpdate”) mydb = mysql.connector.connect(host=“localhost”, user=“root”, passwd=“root”, database=“Test”, cursorclass=pymysql.cursors.DictCursor) mycursor = mydb.cursor()

sql = 'SELECT * FROM information_schema.tables WHERE table_name = "names_table" LIMIT 1;'

mycursor.execute(sql)
mydb.commit()
sql_result = mycursor.fetchall()
print("Done")

Thank you for your help.

It’s possible you’re action server SDK is incompatible with the rasa version. Which SDK and Rasa versions are you running?

With the release of Rasa 2.8.34 and the SDK 2.8.11 compression was added to the protocol which means that you have to upgrade both Rasa and the SDK together. It’s possible you’re running mismatched versions.