Connecting MLab MongoDB to Rasa Core

I keep getting the following “Authorization” error when I run docker-compose on a simple rasa set up with 3 containers: Rasa_NLU, Rasa_Core, and action_server

the core has access to an endpoints.yml file, which contains the following tracker_store code w/ actual values of course:

tracker_store: store_type: mongod url: mongodb://ds<unique_num>.mlab.com:port db: rasa username: “username” password: “password” collection: conversations

rasa_core | 2018-12-04 01:36:28 INFO root - Rasa process starting rasa_core | Traceback (most recent call last): rasa_core | File “/usr/local/lib/python3.6/runpy.py”, line 193, in _run_module_as_main rasa_core | “main”, mod_spec) rasa_core | File “/usr/local/lib/python3.6/runpy.py”, line 85, in _run_code rasa_core | exec(code, run_globals) rasa_core | File “/app/rasa_core/run.py”, line 244, in rasa_core | None, _endpoints.tracker_store, _broker) rasa_core | File “/app/rasa_core/tracker_store.py”, line 40, in find_tracker_store rasa_core | **store.kwargs) rasa_core | File “/app/rasa_core/tracker_store.py”, line 202, in init rasa_core | self._ensure_indices() rasa_core | File “/app/rasa_core/tracker_store.py”, line 209, in _ensure_indices rasa_core | self.conversations.create_index(“sender_id”) rasa_core | File “/usr/local/lib/python3.6/site-packages/pymongo/collection.py”, line 1571, in create_index rasa_core | self.__create_index(keys, kwargs) rasa_core | File “/usr/local/lib/python3.6/site-packages/pymongo/collection.py”, line 1459, in __create_index rasa_core | with self._socket_for_writes() as sock_info: rasa_core | File “/usr/local/lib/python3.6/contextlib.py”, line 81, in enter rasa_core | return next(self.gen) rasa_core | File “/usr/local/lib/python3.6/site-packages/pymongo/mongo_client.py”, line 870, in _get_socket rasa_core | with server.get_socket(self.__all_credentials) as sock_info: rasa_core | File “/usr/local/lib/python3.6/contextlib.py”, line 81, in enter rasa_core | return next(self.gen) rasa_core | File “/usr/local/lib/python3.6/site-packages/pymongo/server.py”, line 168, in get_socket rasa_core | with self.pool.get_socket(all_credentials, checkout) as sock_info: rasa_core | File “/usr/local/lib/python3.6/contextlib.py”, line 81, in enter rasa_core | return next(self.gen) rasa_core | File “/usr/local/lib/python3.6/site-packages/pymongo/pool.py”, line 852, in get_socket rasa_core | sock_info.check_auth(all_credentials) rasa_core | File “/usr/local/lib/python3.6/site-packages/pymongo/pool.py”, line 570, in check_auth rasa_core | auth.authenticate(credentials, self) rasa_core | File “/usr/local/lib/python3.6/site-packages/pymongo/auth.py”, line 486, in authenticate rasa_core | auth_func(credentials, sock_info) rasa_core | File “/usr/local/lib/python3.6/site-packages/pymongo/auth.py”, line 466, in _authenticate_default rasa_core | return _authenticate_scram_sha1(credentials, sock_info) rasa_core | File “/usr/local/lib/python3.6/site-packages/pymongo/auth.py”, line 209, in _authenticate_scram_sha1 rasa_core | res = sock_info.command(source, cmd) rasa_core | File “/usr/local/lib/python3.6/site-packages/pymongo/pool.py”, line 477, in command rasa_core | collation=collation) rasa_core | File “/usr/local/lib/python3.6/site-packages/pymongo/network.py”, line 116, in command rasa_core | parse_write_concern_error=parse_write_concern_error) rasa_core | File “/usr/local/lib/python3.6/site-packages/pymongo/helpers.py”, line 210, in _check_command_response rasa_core | raise OperationFailure(msg % errmsg, code, response) rasa_core | pymongo.errors.OperationFailure: Authentication failed.

I change the url and get back that there was a timeout error, so pymongo is definitely reaching the url, it’s just not getting past the authentification.

PS: I am positive that my tracker_store information is correct/

I am having the same issue with the MongoDb tracker store. I am able to connect to MongoDB (Mlab) through command line but not getting a authentication problem which running docker-compose. Can anyone suggest what to do ?

1 Like

Anybody?

I managed to do it. This the code for tracker_store in endpoints.yml

tracker_store:  
        store_type : mongod
        url : dsXXXX.mlab.com:XXXX
        db: databasename
        username : username
        password : password
        auth_source : databasename
1 Like

I added auth_source: databasename and it worked. They should update it in the documentation.