element-hq / chatterbox

Chatterbox lets you securely embed Hydrogen on any website!
Apache License 2.0
172 stars 21 forks source link

Kind is undefined #80

Closed andrejohansson closed 2 years ago

andrejohansson commented 2 years ago

Describe the bug

When a new user tries to chat with me from my page, it seems that the registration on my homeserver is too slow and the user is greeted with an error. Reloading the page or pressing the chat button again corrects the problem. It seems like some race condition from the chat app while waiting for the user registration to complete.

To Reproduce

Expected behavior The chat window to load properly on first key press without any error.

Screenshots image

image

image

Desktop (please complete the following information):

Additional context Same behavior in different browsers and on different devices.

ptman commented 2 years ago

Here is the stack trace from my instance:

Something went wrong…
Cannot read properties of undefined (reading 'kind')
This occurred while running at Rh (http://localhost:8000/assets/main.282d333f.js:4:6943).

TypeError: Cannot read properties of undefined (reading 'kind')
    at http://localhost:8000/assets/main.282d333f.js:20:15723
    at http://localhost:8000/assets/main.282d333f.js:5:6739
    at wc._addReplaceNodeBinding (http://localhost:8000/assets/main.282d333f.js:5:6117)
    at wc.mapView (http://localhost:8000/assets/main.282d333f.js:5:6536)
    at Ay.render (http://localhost:8000/assets/main.282d333f.js:20:15680)
    at Ay.mount (http://localhost:8000/assets/main.282d333f.js:5:3961)
    at Oi (http://localhost:8000/assets/main.282d333f.js:4:6885)
    at wc.view (http://localhost:8000/assets/main.282d333f.js:5:6503)
    at http://localhost:8000/assets/main.282d333f.js:5:6771
    at n (http://localhost:8000/assets/main.282d333f.js:5:6183)
ptman commented 2 years ago

Upon refresh it does load, but even though it shows invite_user joining, it still states "Waiting for operator to join"

MidhunSureshR commented 2 years ago

This should be fixed on main, feel free to reopen if you still have issues.

MidhunSureshR commented 2 years ago

Upon refresh it does load, but even though it shows invite_user joining, it still states "Waiting for operator to join"

That "Waiting for operator to join" is a feature. Change disable_composer_until_operator_join to false in config.json to disable this.

ptman commented 2 years ago

I get that it's a feature. But the invited user joined. And still the condition to hide that message wasn't met. What is the condition that needs to be satisfied?

MidhunSureshR commented 2 years ago

So if you have that feature turned on, your PL is set to a low enough value that you cannot send messages. The invited user must bump your PL up so that you can send messages. I see now that this isn't communicated clearly in the documentation.