Example for custom action / docker-compose not working

If i put ‘hi’ or other, it works and returns the value, but if i put something to process the custom action, write in log but doesn’t returns nothing. Is like work ok from rasa to actions but can’t exit from action image.

All the code could be found here:

image

Custom action;:

class definition(Action):
    def name(self):
        return "definition"
    def run(self, dispatcher, tracker, domain):
        logger.info("Entro por aqui")
        request = requests.get('http://api.icndb.com/jokes/random').json()  # make an api call
        joke = request['value']['joke']  # extract a joke from returned json response
        logger.info("Devuelvo esto: {}".format(joke))
        dispatcher.utter_message(joke)  # send the message back to the user
        return []

End point: action_endpoint: url: “http://action_server:5055/webhook”

config:

Configuration for Rasa NLU.

Components

language: en

pipeline: supervised_embeddings

Configuration for Rasa Core.

Policies

policies:

  • name: MemoizationPolicy

  • name: KerasPolicy

  • name: MappingPolicy

Docker-compose:

version: '3.0'
services:
  rasa:
    image: rasa/rasa:latest-full
    ports:
      - 5005:5005
    volumes:
      - ./:/app
    command:
      - run
  action_server:
    image: rasa/rasa-sdk:latest
    volumes:
      - ./actions:/app/actions

Can you please format your code in code blocks? That would make it way easier to read for everyone :slight_smile:

Done! :sweat_smile:

Can someone help me with this?

In your docker-compose above I don’t see port 5055 exposed for the action_server although it is set correctly in your git repo.

    ports:
      - 5055:5055

Can you attach the log, docker-compose logs from a message flow that should run action_joke?

ports: - 5055:5055

Enabled in the code.

Hi, I’m struggling with this, too. Did you manage to fix it after all?