Exception occurred in one of response middleware handlers

This seems like a bug and I’ve opened a bug report here: Server sends response once and doesn't respond on subsequent calls. · Issue #4568 · RasaHQ/rasa · GitHub

If anyone has stumbled upon the same error and been able to resolve it, please do let me know.

Thanks!

This is a problem with the Access-Control-Allow-Origin header. Try to start rasa with the command: "rasa run -m models/20191007-115129.tar.gz --enable-api --log-file out.log --cors * The problem should be solved then.

I did see the --cors solution is some other topic as well. However, adding that just suppresses the error log. The problem of empty response being returned on the second call still persists even with the --cors option.

Then it’s a problem with the policies. If you write the same message twice, Rasa Core will have a very low confidence score for the second message and will not play a reply. To avoid this, you should also use the FallbackPolicy. If the confidence score is too low, a template defined with the FallbackPolicy will be played.

Hmm… Then shouldn’t that be obvious when parsing the same message twice too? However, when making calls to /model/parse multiple times with the same message, I get a "confidence":1.0 each time.

(unreal) ➜  django git:(test-rasa) ✗ curl -H "Content-Type:application/json" -X POST -d '{"text":"Im just browsing for fun."}' "http://localhost:5005/model/parse"

{"intent":{"name":"just_browsing","confidence":1.0},"entities":[],"intent_ranking":[{"name":"just_browsing","confidence":1.0},{"name":"wrong_number","confidence":0.0}],"text":"Im just browsing for fun."}%

(unreal) ➜  django git:(test-rasa) ✗ curl -H "Content-Type:application/json" -X POST -d '{"text":"Im just browsing for fun."}' "http://localhost:5005/model/parse"

{"intent":{"name":"just_browsing","confidence":1.0},"entities":[],"intent_ranking":[{"name":"just_browsing","confidence":1.0},{"name":"wrong_number","confidence":0.0}],"text":"Im just browsing for fun."}%

(unreal) ➜  django git:(test-rasa) ✗ curl -H "Content-Type:application/json" -X POST -d '{"text":"Im just browsing for fun."}' "http://localhost:5005/model/parse" 

{"intent":{"name":"just_browsing","confidence":1.0},"entities":[],"intent_ranking":[{"name":"just_browsing","confidence":1.0},{"name":"wrong_number","confidence":0.0}],"text":"Im just browsing for fun."}%

As for the /rest/ endpoint, even if I use different messages, it response is empty from the second call onwards. See:

(unreal) ➜  django git:(test-rasa) ✗ curl -H "Content-Type:application/json" -X POST -d '{"sender": "Batman", "message":"do not message me"}' "http://localhost:5005/webhooks/rest/webhook"
            
[{"recipient_id":"Batman","text":"My sincere apologies. I will take you off the list right away!"}]

(unreal) ➜  django git:(test-rasa) ✗ curl -H "Content-Type:application/json" -X POST -d '{"sender": "Batman", "message":"do not message me"}' "http://localhost:5005/webhooks/rest/webhook"

[]%

(unreal) ➜  django git:(test-rasa) ✗ curl -H "Content-Type:application/json" -X POST -d '{"sender": "Batman", "message":"browsing for fun"}' "http://localhost:5005/webhooks/rest/webhook"

[]%

When using the model/parse endpoint, Rasa Core won’t get used. This endpoint is just using the NLU, so no Core confidence score and no policies included. But still weird, that you do not get any responses. Did you try out the solution with the FallbackPolicy?

I see.

And yep, tried with the FallbackPolicy and that keeps returning the action mentioned there despite whatever message I give it.

However, the Fallback seems like it should be used just for that purpose itself - a fallback. If we don’t receive a response for the same message that comes in, then it doesn’t really make sense in terms of using this to solve our business problem.

In any case, the issue indeed seems to be a bug which they mentioned they have fixed, but it still hasn’t been fixed: Server sends response once and doesn't respond on subsequent calls. · Issue #4568 · RasaHQ/rasa · GitHub

And sincerely, again, thank you so much for following up and helping out. :slight_smile:

Was indeed a bug: Server sends response once and doesn't respond on subsequent calls. · Issue #4568 · RasaHQ/rasa · GitHub