Rasa server

Hello Again i have created a bot and now i want to connect them via http i show i can do it with channel rest input i am use the default rest channel, when i post something to the server i get that error:

2018-11-06 09:23:10 ERROR    flask.app  - Exception on /webhooks/rest/webhook [POST]
Traceback (most recent call last):
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\flask\app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\flask\app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\flask_cors\extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\flask\app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\flask\_compat.py", line 35, in reraise
    raise value
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\flask\app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\flask\app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\rasa_core\channels\channel.py", line 325, in receive
    sender_id = self._extract_sender(request)
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\rasa_core\channels\channel.py", line 293, in _extract_sender
    return req.json.get("sender", None)
AttributeError: 'NoneType' object has no attribute 'get'
127.0.0.1 - - [2018-11-06 09:23:10] "POST /webhooks/rest/webhook HTTP/1.1" 500 412 0.009183

somenone have some idea what i did wrong

Can you format it with ```

This is hard to read

1 Like

Now shows that error:

Traceback (most recent call last):
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\flask\app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\flask\app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\flask_cors\extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\flask\app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\flask\_compat.py", line 35, in reraise
    raise value
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\flask\app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\flask\app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\rasa_core\channels\channel.py", line 336, in receive
    input_channel=self.name()))
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\rasa_core\agent.py", line 305, in handle_message
    return processor.handle_message(message)
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\rasa_core\processor.py", line 77, in handle_message
    tracker = self.log_message(message)
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\rasa_core\processor.py", line 123, in log_message
    self._handle_message_with_tracker(message, tracker)
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\rasa_core\processor.py", line 256, in _handle_message_with_tracker
    parse_data = self._parse_message(message)
  File "C:\Users\Ramon\Desktop\RASA-PYTHON\RASA-FILES\lib\site-packages\rasa_core\processor.py", line 232, in _parse_message
    if (message.text.startswith(INTENT_MESSAGE_PREFIX) or
AttributeError: 'NoneType' object has no attribute 'startswith'
127.0.0.1 - - [2018-11-06 12:31:07] "POST /webhooks/rest/webhook HTTP/1.1" 500 444 0.006995

The code i use to run the server is:

python -m rasa_core.run --port 5002 --enable_api -d models/core/xonebot -u models/nlu/default/xonebot --endpoints endpoints.yml --credentials credentials.yml --debug

What did you send as request?

with postman i send that:

{ “sender”: “Rasa”, “text”: “Hola” }

to localhost addres:

http://localhost:5002/webhooks/rest/webhook

send message instead of text in your request.json

{ “sender”: “Rasa”, “message”: “Hola” }

1 Like

thank you now works

1 Like

Hi, @souvikg10, I am accessing my RASA server from the front end as you have suggested. The message goes something like this: { “sender”: “Rasa”, “message”: “Hi there!” } But, after few hits I am getting the following error: if message.text.startswith(INTENT_MESSAGE_PREFIX): AttributeError: ‘NoneType’ object has no attribute ‘startswith’ and henceforth the bot doesn’t work as expected

I think it has something to do with the escape sequence. What is the message you are sending?

is it some payload with intent prefixed with /

The object sent is None from the front end most likely due to wrong JSON notation. Check the console log of what is being sent to the server as a request

Thank you so much for the prompt reply @souvikg10. Yes, I have some buttons and on clicking it it will be returning the payload prefixed with / and will be setting a slot value as well.

As you suggested I removed it and tried. Now an extra character " is being send to the server on clicking the button which leads to wrong responses. Any thoughts on that?