Action server error

Hello,

I am receiving the below error while talking with the bot. This error is occuring after series of interactions with the bot. May I know, how to solve it?

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

As the error recommends, please check the logs in the terminal in which you ran rasa run actions and share your action.

Hi Chris, Thanks for your reply. I ran rasa run actions and got the below.

2021-12-12 15:00:06 INFO     rasa_sdk.endpoint  - Starting action endpoint server...
2021-12-12 15:00:07 INFO     rasa_sdk.executor  - Registered function for 'action_session_start'.
2021-12-12 15:00:07 INFO     rasa_sdk.executor  - Registered function for 'action_restart'.
2021-12-12 15:00:07 INFO     rasa_sdk.executor  - Registered function for 'action_explain_welcome_form'.
2021-12-12 15:00:07 INFO     rasa_sdk.executor  - Registered function for 'action_calculate_subjective_financial_health_score'.
2021-12-12 15:00:07 INFO     rasa_sdk.executor  - Registered function for 'action_financial_health_score_feedback'.
2021-12-12 15:00:07 INFO     rasa_sdk.executor  - Registered function for 'action_get_stock_price'.
2021-12-12 15:00:07 INFO     rasa_sdk.executor  - Registered function for 'action_calculate_financial_knowledge_score'.
2021-12-12 15:00:07 INFO     rasa_sdk.executor  - Registered function for 'validate_subjective_financial_health_score_form'.
2021-12-12 15:00:07 INFO     rasa_sdk.executor  - Registered function for 'validate_financial_knowledge_score_form'.
2021-12-12 15:00:07 INFO     rasa_sdk.endpoint  - Action endpoint is up and running on http://0.0.0.0:5055

Can you please tell me how to fix now?

@Priya123 Did you mentioned all the actions in domain.yml ? and what error now you seeing while running rasa shell --debug and rasa run actions --debug when talking to the bot?

Can you even share the rasa --version please.

Hi , running rasa run actions --port 5056 on a seperate terminal and then running rasa shell on another terminal, I get the following shown in the actions terminal

Exception occurred while handling uri: 'http://localhost:5056/webhook'
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/sanic/app.py", line 931, in handle_request
    response = await response
  File "/usr/local/lib/python3.7/site-packages/rasa_sdk/endpoint.py", line 104, in webhook
    result = await executor.run(action_call)
  File "/usr/local/lib/python3.7/site-packages/rasa_sdk/executor.py", line 398, in run
    action(dispatcher, tracker, domain)
  File "/usr/local/lib/python3.7/site-packages/rasa_sdk/utils.py", line 230, in call_potential_coroutine
    return await coroutine_or_return_value
  File "/mnt/c/dfavirtual/dfa/chatbot/actions/actions_fhs.py", line 145, in run
    db.save(financial_health_score, SubjectiveFinancialHealthScore)
  File "/mnt/c/dfavirtual/dfa/chatbot/actions/database_utils.py", line 53, in save
    engine = self._create_engine()
  File "/mnt/c/dfavirtual/dfa/chatbot/actions/database_utils.py", line 37, in _create_engine
    url = self._build_db_url()
  File "/mnt/c/dfavirtual/dfa/chatbot/actions/database_utils.py", line 12, in _build_db_url
    db_user = os.environ["DB_USER"]
  File "/usr/local/lib/python3.7/os.py", line 678, in __getitem__
    raise KeyError(key) from None
KeyError: 'DB_USER'
Exception occurred while handling uri: 'http://localhost:5056/webhook'
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/sanic/app.py", line 931, in handle_request
    response = await response
  File "/usr/local/lib/python3.7/site-packages/rasa_sdk/endpoint.py", line 104, in webhook
    result = await executor.run(action_call)
  File "/usr/local/lib/python3.7/site-packages/rasa_sdk/executor.py", line 398, in run
    action(dispatcher, tracker, domain)
  File "/usr/local/lib/python3.7/site-packages/rasa_sdk/utils.py", line 230, in call_potential_coroutine
    return await coroutine_or_return_value
  File "/mnt/c/dfavirtual/dfa/chatbot/actions/actions_fhs.py", line 172, in run
    score = int(tracker.get_slot(self._FHS))
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

My rasa versions are as below;

Rasa Version      :         2.7.0
Minimum Compatible Version: 2.6.0
Rasa SDK Version  :         2.7.0
Rasa X Version    :         0.41.1
Python Version    :         3.7.0
Operating System  :         Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-debian-bullseye-sid
Python Path       :         /usr/local/bin/python3.7

@Priya123 this issue is related to the main issue? can you please briefly explain your use case or project you doing and related files if possible? please use format for the code share.

The error is right here. self._FHS is None and you’re trying to convert it to an integer.

Basic Python will help you solve the issue:

fhs = tracker.get_slot(self._FHS)
score = 0 if fhs is None else int(fhs)