Hi!,I try to run my bot but appears this problem: “Encountered an exception while running action ‘search_contratti’. Bot will continue, but the actions events are lost. Make sure to fix the exception in your custom code.”
Before I have run the commands to activate the action server:
python -m rasa_core_sdk.endpoint --actions actions
(and I don’t have problem with it, because at the end the output is “Action endpoint is up and running. on”)
It’s possible that my code in custom action is not so good, because it’s my first time with Rasa and Sql Server. I post my script so you can see if there is any kind of errors:
actions.py
def name(self):
return “search_contratti”
def run(self, dispatcher, tracker, domain):
filter = tracker.get_slot("tipo_contratto")
conn = pyodbc.connect(
'DRIVER={###};SERVER=## ;PORT=##;DATABASE=##;UID=##;PWD=##')
dispatcher.utter_message("Sto cercando il contratto")
cursor = conn.cursor()
return cursor.execute('SELECT TOP 5 * FROM [##].[##].[##] '
' where c=58 and GRP2 like ?', SlotSet("matches", filter)).fetchall()
This is the first, there is another action but the code is almost the same but if can help I’ll also post the other custom action.
I’ll try different solution but the problem is always the same. Thank you and sorry for my bad English but I’m Italian and I’m studying to improve it.
It’s a problem if Rasa Core is on a different server?
Sorry if my question are stupid but I really try different solutions and I don’t resolve the problem
ok, in the last picture that I post the action server seems to be 5055. So I change the action_endpoint in the endpoint.yml. It’s strange because I decide to use a Http Server because before the action doesn’t run. Now, after this change, this is the situation:
Not really, because now there aren’t errors but anyway the action doesn’t give anything in return I don’t understand why. If you look at the first picture, after a custom action this is the answer
How to change server action from 5055 to another? Because the action server that I want isn’t 5055, in my endpoint.yml there is the right localhost but when I run the comand python -m rasa_core_sdk.endpoint --actions actions it run the action on the 5055 server
hello,have you solved your problem?I think I just met the same problem as you did.
I used the ‘–debug’ in the interactive learning mode,so my error logs shown like this:
@DanielaMilo
The endpoint.yml should refer to the port where the action server is running. So you can’t set the port number in the endpoint file.
The default port where the action server is running, is 5055. This is defined in the rasa_core_sdk.endpoint. You could change the number there, but I’m not sure why you wouldn’t want your action file to run on 5055.
In the pictures of the post where you said you changed the action_endpoint in the endpoint.yml to 5055, there seems to be some sort of problem with your action file.
the message: (“Invalid parameter type, param-index-0 param-type=type”, “HY105”)
shouldn’t be there.
Could you try to run a simple custom action? For example
class ActionTest(Action):
def name(self):
return "action_test"
def run(self, dispatcher, tracker, domain):
dispatcher.utter_message("Just a test to check if my action server is working correctly")
Thank you for the answers. I solved my problem: when I activate the action server use this command:
python -m rasa_core_sdk.endpoint --actions actions -p 8081
In this way the action server run on the port that I want.
thanks for your reply, I’ve already solved my problem, when I written my actions, I returned a string in my run() method, and that’s why I got the exception. So I change to return [], everything does well now