Rasa: Attempt to decode JSON with unexpected mimetype: text/html

Created on 6 Jun 2019  路  8Comments  路  Source: RasaHQ/rasa

Rasa version:

rasa --version
Rasa 1.0.0

Rasa X version (if used & relevant):

rasa/rasa-x:stable from docker

Python version:
python3 --version
Python 3.6.8

Operating system (windows, osx, ...):

Linux 7e5eb7ff3f80 4.4.0-1083-aws #93-Ubuntu SMP Wed May 8 16:08:41 UTC 2019 x86_64 GNU/Linux

Issue:

  1. Run rasa-x, login
  2. select an model that has already been trained
  3. click "talk to your bot" and enter text

ERROR: nothing happens. Log of production container shows the following:

$ docker logs -f rasa_rasa-production_1
[...]
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/sanic/app.py", line 917, in handle_request
    response = await response
  File "/usr/local/lib/python3.6/site-packages/rasa/core/channels/channel.py", line 430, in receive
    sender_id = await self._extract_sender(request)
  File "/usr/local/lib/python3.6/site-packages/rasa/core/channels/rasa_chat.py", line 50, in _extract_sender
    user = await self._check_token(req.headers.get("Authorization"))
  File "/usr/local/lib/python3.6/site-packages/rasa/core/channels/rasa_chat.py", line 38, in _check_token
    return await resp.json()
  File "/usr/local/lib/python3.6/site-packages/aiohttp/client_reqrep.py", line 1027, in json
    headers=self.headers)
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html'

Is this a known issue? This is using the following versions of aiohttp

$ pip3 list | grep aio
aiofiles                0.4.0   
aiohttp                 3.5.4  
type

Most helpful comment

@ddombrowsky It's probably due to a wrong entry in credentials.yml - this will be fixed in the next release. in the meantime, can you change the contents of the /etc/rasa/credentials.yml to

rasa:
  url: ${RASA_X_HOST}/api

and try again?

All 8 comments

@ricwo i remember seeing this bug, not sure what caused it though, do you know?

@akelad This is a clean setup, using an amazon EC2 instance, and using the docker-based instructions in http://rasa.com/docs/rasa-x/deploy/ (making use of the install.sh script). Is there a way I can test the API call to the server, to see if it is actually responding with the wrong mime type?

@ddombrowsky It's probably due to a wrong entry in credentials.yml - this will be fixed in the next release. in the meantime, can you change the contents of the /etc/rasa/credentials.yml to

rasa:
  url: ${RASA_X_HOST}/api

and try again?

@ricwo
Thank you very much. Updating credentials.yml seems to have brought the bot back to life.
I will check to see if https://github.com/RasaHQ/rasa/issues/3723 was caused by the same issue.

@ricwo
Out of curiosity, is the root cause the fact that the worker was hitting the wrong url, and the server was responding with some 404 HTML page, which the worker was then trying to interpret as JSON, and failing? Is that the theory?

@ddombrowsky yes, that's correct 馃檪

I got same error. Thanks @ricwo your solutions solved it

i'm gonna close this issue now, a fix will be part of an upcoming release

Was this page helpful?
0 / 5 - 0 ratings