Custom Action Utter message not working

Hi,

I’ve got the sample code setup with the default “ActionHelloWorld” enabled.

I’ve tried searching on here and I can’t seem to find a solution, even though other people have had this same issue.

I’m using vscode with python 3.7.5 To run the action server I’m running rasa run actions To run rasa i’m using rasa shell

The rasa actions server is receiving and registering the function, but the “Hello World!” response is not being returned. When I used postman to send my own post command to the server, it is returning “Hello World!” under the image tag.

The action endpoint is enabled as: action_endpoint: url: “http://localhost:5055/webhook

nlu.md

## intent:hello_world
- hello world

stories.md

## hello world
* hello_world
  - action_hello_world

domain.yml

intents:
  - hello_world
actions:
 - action_hello_world


from typing import Any, Text, Dict, List

from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher


class ActionHelloWorld(Action):

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

    def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

        dispatcher.utter_message("Hello World!")

        return []

Hi @James, Can you try rasa run actions --actions actions command instead. I got the same issue back then.

Thank you, that works!

Glad that worked :blush: and use that command after you add a new action to the action file. Otherwise new action won’t get triggered.

Hi @James and @durashi,

I’m facing the same problem here. I have exactly the same configuration as @James and I tried to use the command rasa run actions --actions actions but it doesn’t solve the issue.

I get the following logs :

2019-12-13 11:32:34 DEBUG    rasa.core.processor  - Action 'action_hello_world' ended with events '['BotUttered(text: None, data: {"elements": null, "quick_replies": null, "buttons": null, "attachment": "Hello World!", "image": "Hello World!", "custom": null}, metadata: {})']'
2019-12-13 11:32:34 INFO     socketio.server  - emitting event "bot_uttered" to 7122c9c91d514a09867fd2945028f975 [/]
2019-12-13 11:32:34 INFO     engineio.server  - 7122c9c91d514a09867fd2945028f975: Sending packet MESSAGE data 2["bot_uttered",{"attachment":{"type":"image","payload":{"src":"Hello World!"}}}]
2019-12-13 11:32:34 DEBUG    rasa.core.policies.memoization  - Current tracker state [{}, {'prev_action_listen': 1.0, 'intent_get_started': 1.0}, {'prev_utter_get_started': 1.0, 'intent_get_started': 1.0}, {'prev_action_listen': 1.0, 'intent_hello_world': 1.0}, {'intent_hello_world': 1.0, 'prev_action_hello_world': 1.0}]
2019-12-13 11:32:34 DEBUG    rasa.core.policies.memoization  - There is no memorised next action
2019-12-13 11:32:34 DEBUG    rasa.core.policies.mapping_policy  - There is no mapped action for the predicted intent, 'hello_world'.
2019-12-13 11:32:34 DEBUG    rasa.core.policies.fallback  - NLU confidence threshold met, confidence of fallback action set to core threshold (0.3).
2019-12-13 11:32:34 DEBUG    rasa.core.policies.ensemble  - Predicted next action using policy_1_KerasPolicy
2019-12-13 11:32:34 DEBUG    rasa.core.processor  - Predicted next action 'action_listen' with confidence 1.00.
2019-12-13 11:32:34 DEBUG    rasa.core.processor  - Action 'action_listen' ended with events '[]'
2019-12-13 11:32:34 DEBUG    rasa.core.lock_store  - Deleted lock for conversation '7122c9c91d514a09867fd2945028f975'.
2019-12-13 11:32:34 DEBUG    websockets.protocol  - server > Frame(fin=True, opcode=1, data=b'42["bot_uttered",{"attachment":{"type":"image","payload":{"src":"Hello World!"}}}]', rsv1=False, rsv2=False, rsv3=False)
2019-12-13 11:32:44 DEBUG    websockets.protocol  - server - event = data_received(<8 bytes>)
2019-12-13 11:32:44 DEBUG    websockets.protocol  - server < Frame(fin=True, opcode=8, data=b'\x03\xe9', rsv1=False, rsv2=False, rsv3=False)
2019-12-13 11:32:44 DEBUG    websockets.protocol  - server - state = CLOSING
2019-12-13 11:32:44 DEBUG    websockets.protocol  - server > Frame(fin=True, opcode=8, data=b'\x03\xe9', rsv1=False, rsv2=False, rsv3=False)
2019-12-13 11:32:44 DEBUG    websockets.protocol  - server x half-closing TCP connection
2019-12-13 11:32:44 DEBUG    websockets.protocol  - server - event = connection_lost(None)
2019-12-13 11:32:44 DEBUG    websockets.protocol  - server - state = CLOSED
2019-12-13 11:32:44 DEBUG    websockets.protocol  - server x code = 1001, reason = [no reason]

And I’m using this commande to run Rasa

rasa run -m models --enable-api --cors "*" --debug

Did I miss something ?

Please help :slight_smile:

Hi,

I resolved this issue, thanks to @Tobias_Wochinger. See the solution here :

what is the solution you tried to fix this?

this is really good, thank you for sharing with us vidmate mobdro