tinode / tinode-js

Tinode javascript bindings
Apache License 2.0
52 stars 42 forks source link

Uncaught TypeError: d[e].props is not a function #72

Closed Ovizro closed 10 months ago

Ovizro commented 10 months ago

Uncaught TypeError: d[e].props is not a function tinode-js crashed when encountering this exception.

To Reproduce Steps to reproduce the behavior:

  1. Send a Drafty message with entity FM and set su field
  2. See error

Expected behavior I hope tinode-js doesn't crash on this exception, consider simply ignoring this exception.

Screenshots image

Environment (please complete the following information):

Console log image

Additional context I speculate that this may be related to this piece of code: https://github.com/tinode/tinode-js/blob/6cdc1963da5043e3f735a49b8671e15c17c2d3d2/src/drafty.js#L1913

Ovizro commented 10 months ago

I tried a simple fix of adding &&d[e].props to the conditional statement on the previous line, which successfully prevented the crash.

or-else commented 10 months ago
  1. Which version of Tinode SDK is this?
  2. Can you reproduce the problem with tinode.dev.js? It will show a useful stack trace.
  3. What are the steps to reproduce the problem?
or-else commented 10 months ago

This will probably fix it: https://github.com/tinode/tinode-js/commit/fc01ef585da6c935e60e21460faf90cbb1dc598f

Ovizro commented 10 months ago

Thanks. The recurrence is basically as I said above, the chat interface crashes after receiving a specific message. This is how I did it before. Since I am now developing a chatbot framework that can be used in tinode, I followed the instructions in drafty.md and sent a message with FM entity and attached data: {su: true} for testing. When I received this message in the chat interface with the bot, the chat interface immediately crashed, leaving only the background. The same situation occurred again when I later entered the chat interface of the bot from the main interface. As for debugging in development mode, please wait a moment.

Ovizro commented 10 months ago

The stack traceback is as follows: image

And the console log at the time of the crash: image image

or-else commented 10 months ago

Did you have a chance to test the fix I posted earlier?

Ovizro commented 10 months ago

I tried copying the src and umd folders into the container and it did behave fine and no longer crashed.