I’m facing this error while running a action in action.py
ERROR rasa.core.actions.action - Failed to run custom action ‘action_pincode’. Couldn’t connect to the server at ‘http://localhost:5055/webhook’. Is the server running? Error: Cannot connect to host localhost:5055 ssl:default [Connection refused]
ERROR rasa.core.processor - Encountered an exception while running action ‘action_pincode’. Bot will continue, but the actions events are lost. Please check the logs of your action server for more information.
actions.py
class Actionpincode(Action):
def name(self) -> Text:
return ACTION_PINCODE
async def run(self,
dispatcher: 'Dispatcher',
tracker: 'DialogueStateTracker',
domain: 'Domain') -> List[Event]:
path = '/pincode.txt'
pincode_file = open(path,'r')
pincodes = pincode_file.read()
print(pincodes)
pin = next(tracker.get_latest_entity_values("pincode"), None)
flag=0
for i in pincodes:
if i==pin:
flag=1
if flag==1:
await dispatcher.utter_message("yes", tracker, silent_fail=True)
else :
await dispatcher.utter_message("no", tracker, silent_fail=True)
return [UserUtteranceReverted()]
@Saurbh060
All right, as you can see when you start the action server there is an error, therefore your Rasa server can not connect to the action server to execute your custom actions. I check the constants.py in Rasa github and don’t see any constant named DOCS_BASE_URL, are you sure this is the right constant that you want to import ? This is the link to the constants.py on github: rasa/constants.py at master · RasaHQ/rasa · GitHub
It said in the log that in you are importing DOCS_BASE_URL in your actions.py at line 11, is this not your intention ? Can you post your actions.py here ?
@fuith Actually I copied this file from somewhere to implement " action_default_fallback " but I think there are some unwanted things that were used in this file.
actions.py (19.1 KB)
This seems to me like an outdated source code actions.py of Rasa. You should only define your own custom actions in your actions.py. I suggest you remove all the copied code and keep only your custom actions. The “action_default_fallback” is already implemented, if you want to customize it, just override it with your own logic.