Skip to content

Uncaught Exception in Text node #625

Description

@GioBar00

Text node generates an uncaughtException when trying to access a field of a variable that is not an object.
node-red-contrib-chatbot version 1.2.4

2023-12-11 18:22:50 11 Dec 17:22:50 - [red] Uncaught Exception:
2023-12-11 18:22:50 11 Dec 17:22:50 - [error] TypeError: Cannot use 'in' operator to search for 'speed' in 12
2023-12-11 18:22:50 at byString(/data/node_modules/node-red-contrib-chatbot/lib/message-template-async.js:13:13)
2023-12-11 18:22:50 at getTokenValue(/data/node_modules/node-red-contrib-chatbot/lib/message-template-async.js:74:15)
2023-12-11 18:22:50 at /data/node_modules/node-red-contrib-chatbot/lib/message-template-async.js:120:13
2023-12-11 18:22:50 at new Promise ()
2023-12-11 18:22:50 at /data/node_modules/node-red-contrib-chatbot/lib/message-template-async.js:119:18
2023-12-11 18:22:50 at runNextTicks (node: internal/process/task_queues:60:5)
2023-12-11 18:22:50 at process.processImmediate (node: internal/timers: 447:9)

I attach a sample flow if you want to test it.
In this example I override the payload of the message as an object with the location attribute as a number.
Then I try to access for example {{payload.location.speed}}, which gives the uncaught exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions