Rasa Stack starter-pack use "Rest Input channel" respose "500 Internal Server Error"

I use Rasa Stack starter-pack(github) to deploy our project, and I add some options for “Rest Input channel”,But server response “500 Internal Server Error”.

  • My endpoints.yml looks like:
  action_endpoint:
  url: "http://localhost:5055/webhook"
  core_endpoint:
  url: "http://localhost:5005"
  • My credentials.yml looks like:
rest:
  • I execute these steps:
python -m rasa_core.run -d models/current/dialogue -u models/current/nlu --credentials credentials.yml --enable_api --endpoints endpoints.yml  &

python -m rasa_core_sdk.endpoint &
  • I post
{
  "message": "hello",
  "sender": "tom"
}

to

localhost:5005/webhooks/rest/webhook

* My core server logs

2018-12-24 10:58:49 ERROR    flask.app  - Exception on /webhooks/rest/webhook [POST]
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/lib64/python2.7/site-packages/flask_cors/extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/lib/python2.7/site-packages/rasa_core/channels/channel.py", line 358, in receive
    sender_id = self._extract_sender(request)
  File "/usr/lib/python2.7/site-packages/rasa_core/channels/channel.py", line 326, in _extract_sender
    return req.json.get("sender", None)
AttributeError: 'NoneType' object has no attribute 'get'
61.48.71.40 - - [2018-12-24 10:58:49] "POST /webhooks/rest/webhook?%22sender%22=%20%22tom%22,&%22message%22=%20%22Hello%22 HTTP/1.1" 500 444 0.001475

Thanks in advance.

Hi @hanhuihui011,

Your set-up is correct. You are only missing a header from your POST request to notify the server of the attached JSON. If you are using POSTMAN, then you can add this in the Headers view with Key Content-Type and value application/json. Otherwise from the command line, just add the following flag:

--header "Content-Type: application/json"

Let me know if this does/doesn’t solve your problem!

1 Like