Custom Input Channel in Docker

Hi Forum,

I am struggling with getting the Google Assistant Example to work in Docker. More precisely I am failing at getting a custom InputChannel loaded by the run.py script of Rasa Core.

In the tutorial you describe a way to run the server by calling the run_app.py script. I would like to run the custom channel in my docker-compose setup.

My docker-compose setup works like a charm for a Telegram chatbot, so I would assume it is not a general issue. I have a file with the name google_assistant_channel.py that looks like so very similar to the tutorial:

import json
import logging

from flask import Blueprint, jsonify, request
from rasa_core.channels.channel import CollectingOutputChannel, InputChannel, UserMessage

logger = logging.getLogger(__name__)


class GoogleAssistantInput(InputChannel):
    """Google Assistant input channel"""

In my docker-compose I map the corresponding module (that means it and an empty __init__.py file) to /app/custom in the container.

After digging a bit into the source code I found out that I should be able to simply provide the module paht in the credentials file for this to be recognised, is this assumption correct?

My credentials.yml file looks as follows:

custom.google_assistant_channel.GoogleAssistantInput:

If I run the container I get the following error:

rasa_1  | Traceback (most recent call last):
rasa_1  |   File "/usr/local/bin/rasa", line 10, in <module>
rasa_1  |     sys.exit(main())
rasa_1  |   File "/usr/local/lib/python3.6/site-packages/rasa/__main__.py", line 70, in main
rasa_1  |     cmdline_arguments.func(cmdline_arguments)
rasa_1  |   File "/usr/local/lib/python3.6/site-packages/rasa/cli/run.py", line 70, in run
rasa_1  |     rasa.run(**vars(args))
rasa_1  |   File "/usr/local/lib/python3.6/site-packages/rasa/run.py", line 61, in run
rasa_1  |     model, channel=channel, credentials=credentials, endpoints=_endpoints, **kwargs
rasa_1  |   File "/usr/local/lib/python3.6/site-packages/rasa/core/run.py", line 132, in serve_application
rasa_1  |     input_channels = create_http_input_channels(channel, credentials)
rasa_1  |   File "/usr/local/lib/python3.6/site-packages/rasa/core/run.py", line 37, in create_http_input_channels
rasa_1  |     return [_create_single_channel(c, k) for c, k in all_credentials.items()]
rasa_1  |   File "/usr/local/lib/python3.6/site-packages/rasa/core/run.py", line 37, in <listcomp>
rasa_1  |     return [_create_single_channel(c, k) for c, k in all_credentials.items()]
rasa_1  |   File "/usr/local/lib/python3.6/site-packages/rasa/core/run.py", line 56, in _create_single_channel
rasa_1  |     "is a proper name of a class in a module.".format(channel)
rasa_1  | Exception: Failed to find input channel class for 'custom.google_assistant_channel.GoogleAssistantInput'. Unknown input channel. Check your credentials configuration to make sure the mentioned channel is not misspelled. If you are creating your own channel, make sure it is a proper name of a class in a module.

I must be doing something wrong with respect to the import paths. Do you have any idea how to tackle this?

Cheers Eric

Hey Eric. Are you using the latest release of rasa or rasa_nlu and rasa_core?

Hi Ella, I am using the rasa/rasa:1.0.0rc6-spacy-en image for core and nlu and the rasa/rasa_core_sdk:1.0.0rc2 image for the sdk. I will update them rasa to 1.0.1 today and switch to rasa-sdk 1.0.0.

1 Like

Awesome, let me know how it goes. You also might have to make sure that any custom modules (channel, run_app.py) are part of your python path, similar to problems with custom components here: Custom component in Rasa 1.0

After I added the custom folder to the PYTHONPATH it worked. Unfortunately there were some other issues with the example, which seems to be outdated as it still uses Flask instead of Sanic. I have it working now :slight_smile: thanks!

Ah yes that’s a good point, I’ll add Sanic to the migrations for custom input and output channels. Thanks for the heads up.

Dear Eric,

great to see that you managed to solve this problem! We are facing the same problem as well.

what we have: ga_connector.py

could you share how you solved this in your PYTHONPATH?

And your code? (if it’s not too much asked :slight_smile: )

Would appreciate it a lot!

Can you please share the details of how you got Google assistant working with rasa 1.0 I used the new code “ga_connector_updated.py”. I also added my files to the python path. Everything runs fine, but when I test it using the simulator I get the following:

  1. ngrok: POST /webhooks/google_assistant/webhook 500 Internal Server Error
  2. Google assistant reply: Social Robot isn’t responding right now. Try again soon.

‘Social Robot’ is tha name of my Action. Note: I’m doing this all on the same port rasa is running on (5005)

Your help would be greatly appreciated as I have no clue what is wrong here.

My action.json file: action.json (927 Bytes)

My credentials file: credentials.yml (728 Bytes)

The ga_connector_updated file: ga_connector_updated.py (3.8 KB)

Hey @jason, the pythonpath issue should be fixed as of 1.1.5 – give it a try :slight_smile:

@Nasr can you post any logs you get on rasa run <other params> --debug when your assistant isn’t responding? How are you running your action server (that server should not be on 5005 but rather 5055)?

Hello Ella, Google Assistant now works fine after the update of the tutorial and the github codes. Thank you for your reply

Cool I’m glad! Juste put in a lot of work to fix the tutorial so good that it’s working out for you :slight_smile: