Rasa_core.processor - Failed to execute custom action

Rasa Versions:
rasa-core-sdk~=0.12.2
rasa_core~=0.13.2
rasa_nlu~=0.14.4

Custom Action file action.py, having following

import logging
import requests
import json
from rasa_core_sdk import Action

logger = logging.getLogger(__name__)

class ApiAction(Action):
    def name(self):
        return "action_match_news"

    def run(self, dispatcher, tracker, domain):
        response = """KK Enjoy !!"""
        print(tracker)
        dispatcher.utter_message(response)
        return

domain.yaml has following

actions:
- utter_greet
- utter_did_that_help
- utter_goodbye
- action_match_news
- utter_default
- utter_gratitude
- utter_ask_again

intents:
- goodbye
- greet
- thanks
- affirm
- deny

templates:
  utter_greet:
  - text: "Hey! What can I do for you?"
  utter_did_that_help:
  - text: "Did that help you?"
  - text: "I hope that solved your query"
  utter_goodbye:
  - text: "Bye"
  utter_default:
  - text: "I am sorry, I didn't get that. Could you please repeat your query?"
  - text: "I am not sure what you are aiming for."
  utter_gratitude:
  - text: "Glad that I could be of help to you!\nBye"
  utter_ask_again:
  - text: "Okay! Let's start again, please tell me what do you need?"
  - text: "No issues! Let's try this again.\n Please repeat your query?"

stories.md has following

## news path 1
* greet
  - utter_greet
* current_matches
  - action_match_news
  - utter_did_that_help
* affirm or thanks
  - utter_gratitude
* goodbye
  - utter_goodbye

## news path 2
* current_matches
  - action_match_news
  - utter_did_that_help
* affirm or thanks
  - utter_gratitude
* goodbye
  - utter_goodbye

## news path 3
* greet
  - utter_greet
* current_matches
  - action_match_news
  - utter_did_that_help
* deny
  - utter_ask_again
* current_matches
  - action_match_news
  - utter_did_that_help
* affirm or thanks
  - utter_gratitude
* goodbye
  - utter_goodbye

Getting following error

2019-10-17 18:44:10 DEBUG    rasa_core.processor  - Predicted next action 'action_match_news' with prob 1.00.
2019-10-17 18:44:10 DEBUG    rasa_core.actions.action  - Calling action endpoint to run action 'action_match_news'.
2019-10-17 18:44:10 ERROR    rasa_core.actions.action  - Failed to run custom action 'action_match_news'. Action server responded with a non 200 status code of 404. Make sure your action server properly runs actions and returns a 200 once the action is executed. Error: 404 Client Error: NOT FOUND for url: http://localhost:5055/
2019-10-17 18:44:10 ERROR    rasa_core.processor  - Encountered an exception while running action 'action_match_news'. Bot will continue, but the actions events are lost. Make sure to fix the exception in your custom code.
2019-10-17 18:44:10 DEBUG    rasa_core.processor  - Failed to execute custom action.

Used example from here

https://www.analyticsvidhya.com/blog/2019/04/learn-build-chatbot-rasa-nlp-ipl/

Hey @kkbrat9, have you ran your custom action server using the below command:

rasa run actions

@JiteshGaikwad: ran action server using this command

python3 -m rasa_core_sdk.endpoint --actions actions

root@ip-172-31-31-102:~/iplbot/try_version# python3 -m rasa_core_sdk.endpoint --actions actions
2019-10-18 14:07:07 INFO     __main__  - Starting action endpoint server...
2019-10-18 14:07:07 INFO     rasa_core_sdk.executor  - Registered function for 'action_match_news'.
2019-10-18 14:07:07 INFO     __main__  - Action endpoint is up and running. on ('0.0.0.0', 5055)

I think so the issue exists in your custom actions, just check the error while your run the custom action server

I don’t see anything specific. Am i missing something ?

root@ip-172-31-31-102:~/iplbot/try_version# python3 -m rasa_core_sdk.endpoint --actions actions
2019-10-18 21:42:35 INFO     __main__  - Starting action endpoint server...
2019-10-18 21:42:35 INFO     rasa_core_sdk.executor  - Registered function for 'action_match_news'.
2019-10-18 21:42:35 INFO     __main__  - Action endpoint is up and running. on ('0.0.0.0', 5055)

@JiteshGaikwad Any suggestion to move forward ?

I tried example as here Actions

  1. So, endpoints.yaml has following
action_endpoint:
  url: "http://localhost:5055/webhook"
  1. Running rasa run actions has following
rasa run actions
/usr/local/lib/python3.6/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
2019-10-21 14:17:16 INFO     rasa_sdk.endpoint  - Starting action endpoint server...
2019-10-21 14:17:16 INFO     rasa_sdk.executor  - Registered function for 'action_hello_world'.
2019-10-21 14:17:16 INFO     rasa_sdk.endpoint  - Action endpoint is up and running on http ('0.0.0.0', 5055)
  1. Now how respond to hello world ?

BTW, modifiied action.py to look as below

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 []

I am able to get thing working. Thanks for the help @JiteshGaikwad

I am having similar issues. Can you post the solution that you followed to get things working?