node-red-contrib-chatbot
node-red-contrib-chatbot copied to clipboard
Telegram Web Hook TypeError: Cannot read property 'message' of undefined
When using a web hook https: // domain_name /redbot/telegram , the following entries constantly appear in my error log:
at ChatServer./redbot/telegram (/home/user/.node-red/node_modules/node-red-contrib-chatbot/lib/platforms/telegram.js:85:16) at Layer.handle [as handle_request] (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/index.js:317:13) at /usr/local/lib/node_modules/node-red/node_modules/express/lib/router/index.js:284:7 at Function.process_params (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/index.js:335:12) at next (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/index.js:275:10) at expressInit (/usr/local/lib/node_modules/node-red/node_modules/express/lib/middleware/init.js:40:5) at Layer.handle [as handle_request] (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/index.js:317:13) at /usr/local/lib/node_modules/node-red/node_modules/express/lib/router/index.js:284:7 at Function.process_params (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/index.js:335:12) at next (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/index.js:275:10) at query (/usr/local/lib/node_modules/node-red/node_modules/express/lib/middleware/query.js:45:5) at Layer.handle [as handle_request] (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/index.js:317:13) at /usr/local/lib/node_modules/node-red/node_modules/express/lib/router/index.js:284:7 at Function.process_params (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/index.js:335:12) at next (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/index.js:275:10) at Function.handle (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/index.js:174:3) at Function.handle (/usr/local/lib/node_modules/node-red/node_modules/express/lib/application.js:174:10) at mounted_app (/usr/local/lib/node_modules/node-red/node_modules/express/lib/application.js:230:10) at Layer.handle [as handle_request] (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
The server:
Compute Engine 1micro in Google Cloud
Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-1042-gcp x86_64)
Node v8.10.0
Npm 3.5.2
Node-red v0.20.8
node-red-contrib-chatbot 0.16.12
is configured according to the instructions from Digital Ocean https://www.digitalocean.com/community/tutorials/how-to-connect-your-internet-of-things-with-node-red-on-ubuntu-16-04
Nginx + SSL Let's Encrypt + Node-Red
Polling mode works (but sometimes it dulls and slows down) but I want to use the fully standard web hook mode
Anyone can help me?
Hi @MrAndreius I cannot see the first part of the error. Next week I'm going to release a big update, I'm a little busy right now, I''l take care of this
these errors occurred when I moved the admin node-red to a new URL ( botsite.com/admin ) and disappeared when returned
big update
I hope there will be an opportunity to specify an arbitrary url for webhook? flow 1 -> bot 1 -> hookurl/123 flow 1 -> bot 2 -> hookurl/2344 flow 3 -> bot 3 -> hookurl/321
You have multiple bots running in the same node-red instance right?
yes, the idea was to use a few bots, but it didn't work
Ok, @MrAndreius so the solution here is be able to specify the path of the webhook
https://d.pr/i/bficJ6
now RedBot listen on /redbot/telegram/ but in the configuration above should understand it should listen on /my-url/redbot/telegram
You can follow the development here https://trello.com/invite/b/JkrjeswQ/80d4df36d8e27d25ed6661e7e7a809a4/redbot
Not sure if exactly same error but at least same error message:
TypeError: Cannot read property 'message' of undefined at ChatServer./redbot/telegram (/opt/iobroker/iobroker-data/node-red/node_modules/node-red-contrib-chatbot/lib/platforms/telegram.js:113:16) ...
looking at source this the culprit
const json = req.body; if (json.message != null) {
where as the json gets not defined. Seems the req var not set right?
Test at telegram/test responds with simply "OK" as intended.
redbot 0.18.15, node-red 1.0.3, admin url moved to /admin, http-nodes moved to /nodes, iobroker based, reverse proxy setup with LE SSL, static public ip
I have the same problem as above -- when setting httpAdminRoot: /admin
we get that error. When unset, the webhook works fine. However, other nodes (such as the Github Webhook node) specifically don't work without it set:
Cannot create github-web hook node when httpAdminRoot set to '/'
So we're in a catch-22 here until this issue gets fixed, and it's been open for 1.5 years.