Error with Rest Endpoint

Hi, I am trying out the latest 0.11.3 of rasa_core and i noticed an error when i run my rest connector

Here’s the error

rasa_en_1  | 172.22.0.1 - - [2018-09-19 13:57:37] "POST /webhooks/rest/webhook HTTP/1.1" 500 412 0.007058
rasa_en_1  | 2018-09-19 14:00:15 ERROR    flask.app  - Exception on /webhooks/rest/webhook [POST]
rasa_en_1  | Traceback (most recent call last):
rasa_en_1  |   File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 2292, in wsgi_app
rasa_en_1  |     response = self.full_dispatch_request()
rasa_en_1  |   File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
rasa_en_1  |     rv = self.handle_user_exception(e)
rasa_en_1  |   File "/usr/local/lib/python2.7/site-packages/flask_cors/extension.py", line 161, in wrapped_function
rasa_en_1  |     return cors_after_request(app.make_response(f(*args, **kwargs)))
rasa_en_1  |   File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1718, in handle_user_exception
rasa_en_1  |     reraise(exc_type, exc_value, tb)
rasa_en_1  |   File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
rasa_en_1  |     rv = self.dispatch_request()
rasa_en_1  |   File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1799, in dispatch_request
rasa_en_1  |     return self.view_functions[rule.endpoint](**req.view_args)
rasa_en_1  |   File "/usr/local/lib/python2.7/site-packages/rasa_core/channels/channel.py", line 327, in receive
rasa_en_1  |     on_new_message(UserMessage(text, collector, sender_id))
rasa_en_1  |   File "/usr/local/lib/python2.7/site-packages/rasa_core/agent.py", line 305, in handle_message
rasa_en_1  |     return processor.handle_message(message)
rasa_en_1  |   File "/usr/local/lib/python2.7/site-packages/rasa_core/processor.py", line 77, in handle_message
rasa_en_1  |     tracker = self.log_message(message)
rasa_en_1  |   File "/usr/local/lib/python2.7/site-packages/rasa_core/processor.py", line 121, in log_message
rasa_en_1  |     self._handle_message_with_tracker(message, tracker)
rasa_en_1  |   File "/usr/local/lib/python2.7/site-packages/rasa_core/processor.py", line 241, in _handle_message_with_tracker
rasa_en_1  |     parse_data = self._parse_message(message)
rasa_en_1  |   File "/usr/local/lib/python2.7/site-packages/rasa_core/processor.py", line 217, in _parse_message
rasa_en_1  |     if (message.text.startswith(INTENT_MESSAGE_PREFIX) or
rasa_en_1  | AttributeError: 'NoneType' object has no attribute 'startswith'

I am running the following command

python -m rasa_core.run -c rest  -d data/servicing-bot-en/models/dialogue -u data/servicing-bot-en/models/servicing-bot-en/model-en --endpoints endpoints.yml --credentials credentials.yml

with the following message

POST /webhooks/rest/webhook HTTP/1.1
Host: localhost:5005
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: 99e5cd1e-fc3e-e0eb-3827-6be81982a603

{
	"sender":"Souvik",
	"text":"i have lost my card"
	
}

Any idea what is wrong here

I found the isssue, turns out there is an error in the documentation - https://rasa.com/docs/core/connectors/#restinput

The post message should be

POST /webhooks/rest/webhook HTTP/1.1
Host: localhost:5005
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: 99e5cd1e-fc3e-e0eb-3827-6be81982a603

{
	"sender":"Souvik",
	"message":"i have lost my card"
	
}

@akelad, @tmbo - Can you please check if this is the case because in the documentation for rest channel vs http api - the POST data request structure isn’t the same.

2 Likes

@souvikg10 do you mind submitting a PR to fix the docs?

which one should it be? message or text?

Sorry, “message” :smiley:

1 Like