-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Receiving custom response invokes TypeError in Widget #258
Comments
Hi, I'm currently looking into your issue, are you using Botfront to create your bot ? ANd are you using the custom response type of Botfront ? |
Yes, I am using Botfront to create the bot, and I'm using the custom response type that I've assigned to the intent, which contains the following:
I got the JSON response from viewing it in the Conversation tab that is inside of the Incoming panel (Using the </> button). Thank you for looking into it! |
Hi @MatthieuJnon, has been an update on this? I am running into the same issue though using Rasa directly and sending custom responses to the client i.e.:
responses:
utter_greet:
- text: "Hey! How are you?"
custom:
key: "value" Thank you! |
Try this responses: |
Any news on this guys? Has it been solved? |
Any updates for this issue? I have met a similar issue too. @mdaqshahab @MatthieuJnon |
It took me a while, but you have to wrap the custom message(s) you send to the Rasa server in metadata, like so: |
Sorry I don't understand what's your meaning,I just add below code between <body> and <\body> of index.html: <script>!(function () { let e = document.createElement("script"), t = document.head || document.getElementsByTagName("head")[0]; (e.src = "https://cdn.jsdelivr.net/npm/[email protected]/lib/index.js"), // Replace 1.x.x with the version that you want (e.async = !0), (e.onload = () => { window.WebChat.default( { customData: { language: "en" }, socketUrl: "http://localhost:5005", // add other props here }, null ); }), t.insertBefore(e, t.firstChild); })(); </script>and the config of response in rasa: Is there any problem? |
Ran into this. Any update? |
I want to create a custom component for handling custom responses that comes in from rasa/botfront but it seems that whenever a custom response comes in, the widget tries to parse it and throws an
Uncaught TypeError: can't access property "metadata", e is null
or something similar.It doesn't matter whether I use the widget in a <script> tag or as a react component and whether I actually declare a custom component to handle custom responses or not. The problem is that if I actually use a custom component, the program crashes since the error repeats in an infinite loop - which means that I basically can't handle custom messages.
Since I cannot actually trace the original problem, below is the full stack trace (if it may be of any help - since the code is minified) and the JSON of the response as is shown in the botfront responses:
Stack Trace
JSON Response
Edit: After a brief investigation it seems that this line is what causes the problem - as for some reason
botUtterance
is null or undefined and thus it cannot access its metadata, throwing the above error.The text was updated successfully, but these errors were encountered: