node-red-contrib-chatbot icon indicating copy to clipboard operation
node-red-contrib-chatbot copied to clipboard

Polling error, Telegram receiver does not work

Open joside opened this issue 7 years ago • 23 comments

I created one simple test workflow as described on your page. In my node-red-log I see error: [polling_error] {"code":"EFATAL","message":"EFATAL: Error: connect ENOENT /botxxxxxxxxx:xxxxxxxxxxxxxxxxxxxx/getUpdates"}

If i am doing curl https://api.telegram.org/botxxxxxxxxx:xxxxxxxxxxxxxxxxxxxx/getUpdates per SSH on the same machine I am getting the correct JSON result.

(Sure, I replaced the token by some x-es)

joside avatar Mar 21 '18 08:03 joside

I tried a quick receiver - text - sender and it works, can you export your flow here (credentials will no be exported)

guidone avatar Mar 21 '18 08:03 guidone

[{"id":"e5c0d433.28da38","type":"chatbot-telegram-receive","z":"2cabaefe.e05382","bot":"d44b252a.24f978","botProduction":"","x":200,"y":300,"wires":[["20c9091b.870a16"]]},{"id":"30c87df2.ab4d12","type":"chatbot-telegram-send","z":"2cabaefe.e05382","bot":"d44b252a.24f978","botProduction":"","track":false,"outputs":0,"x":640,"y":320,"wires":[]},{"id":"20c9091b.870a16","type":"chatbot-message","z":"2cabaefe.e05382","name":"","message":[""],"answer":false,"track":false,"x":420,"y":320,"wires":[["30c87df2.ab4d12"]]},{"id":"d44b252a.24f978","type":"chatbot-telegram-node","z":"","botname":"JosiBot","usernames":"","polling":"1000","store":"56baf89d.4bbd88","log":"","parseMode":""},{"id":"56baf89d.4bbd88","type":"chatbot-context-store","z":"","name":"josibot_context","contextStorage":"memory","contextParams":""}]

joside avatar Mar 21 '18 08:03 joside

... I hope I did the export correctly, never did this before in node-red...

joside avatar Mar 21 '18 08:03 joside

The message is blank

https://d.pr/i/SrUwrI

guidone avatar Mar 21 '18 08:03 guidone

[{"id":"e5c0d433.28da38","type":"chatbot-telegram-receive","z":"2cabaefe.e05382","bot":"d44b252a.24f978","botProduction":"","x":200,"y":300,"wires":[["20c9091b.870a16"]]},{"id":"30c87df2.ab4d12","type":"chatbot-telegram-send","z":"2cabaefe.e05382","bot":"d44b252a.24f978","botProduction":"","track":false,"outputs":0,"x":640,"y":320,"wires":[]},{"id":"20c9091b.870a16","type":"chatbot-message","z":"2cabaefe.e05382","name":"","message":[{"message":"Hello!"}],"answer":false,"track":false,"x":420,"y":320,"wires":[["30c87df2.ab4d12"]]},{"id":"d44b252a.24f978","type":"chatbot-telegram-node","z":"","botname":"JosiBot","usernames":"","polling":"1000","store":"56baf89d.4bbd88","log":"","parseMode":""},{"id":"56baf89d.4bbd88","type":"chatbot-context-store","z":"","name":"josibot_context","contextStorage":"memory","contextParams":""}]

joside avatar Mar 21 '18 08:03 joside

Added a text. But this does not change anything, still getting that error in the logs. For me it looks like that the URL is not complete and node is looking for a file instead of a web resource. Am I missing some setting for the api-domain maybe?

joside avatar Mar 21 '18 08:03 joside

It works on my machine, I'm using this library internally

https://github.com/yagop/node-telegram-bot-api

this error comes straight from this lib, since ENOENT means something like "error no entity" is it possible that in the token configuration there is an extra space or something like that? Something that may corrupt the link https://api.telegram.org/botxxxxxxxxx:xxxxxxxxxxxxxxxxxxxx/getUpdates ?

guidone avatar Mar 21 '18 08:03 guidone

No, I can't find any corrupting characters. Did a npm update and restartet node-red. Still the same.

Starting as a systemd service.
Started Node-RED graphical event wiring tool..
21 Mar 10:16:23 - [info]
Welcome to Node-RED

21 Mar 10:16:23 - [info] Node-RED version: v0.17.5
21 Mar 10:16:23 - [info] Node.js  version: v8.9.3
21 Mar 10:16:23 - [info] Linux 4.9.59-v7+ arm LE
21 Mar 10:16:25 - [info] Loading palette nodes
21 Mar 10:16:29 - [info] RedBot version: 0.9.27 (node-red-contrib-chatbot)
Wed, 21 Mar 2018 09:16:36 GMT node-telegram-bot-api deprecated Automatic enabling of cancellation of promises is deprecated.
In the future, you will have to enable it yourself.
See https://github.com/yagop/node-telegram-bot-api/issues/319. at module.js:635:30
21 Mar 10:16:46 - [info] Settings file  : /home/pi/.node-red/settings.js
21 Mar 10:16:46 - [info] User directory : /home/pi/.node-red
21 Mar 10:16:46 - [info] Flows file     : /home/pi/.node-red/flows_nodered.json
21 Mar 10:16:46 - [info] Server now running at http://127.0.0.1:1880/
21 Mar 10:16:46 - [info] Starting flows
Telegram Bot JosiBot will be launched, environment is development
21 Mar 10:16:46 - [info] [e-mail in:798b36d7.d01138] Checking IMAP for new messages
21 Mar 10:16:47 - [info] Started flows
error: [polling_error] {"code":"EFATAL","message":"EFATAL: Error: connect ENOENT /bot123456789:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/getUpdates"}
error: [polling_error] {"code":"EFATAL","message":"EFATAL: Error: connect ENOENT /bot123456789:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/getUpdates"}
error: [polling_error] {"code":"EFATAL","message":"EFATAL: Error: connect ENOENT /bot123456789:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/getUpdates"}

joside avatar Mar 21 '18 09:03 joside

Ok it’s a Raspberry, could it be a problem of permission? You are curl-ing from shell as root but perhaps the process of node-res has not enough privileges, can you try doing the same http call you’re doing with curl in a http node inside node-red? If http node doesn’t work it should be a permission problem for node-red

guidone avatar Mar 21 '18 10:03 guidone

Sorry to say that this also does work: [{"id":"9f0f19f5.33fa28","type":"debug","z":"2cabaefe.e05382","name":"","active":true,"console":"false","complete":"true","x":630,"y":560,"wires":[]},{"id":"24851e03.e8ac82","type":"http request","z":"2cabaefe.e05382","name":"","method":"GET","ret":"txt","url":"https://api.telegram.org/botXXXXXXXXXXXXXXXX/getUpdates","tls":"","x":450,"y":560,"wires":[["9f0f19f5.33fa28"]]},{"id":"dfc78e33.9b631","type":"inject","z":"2cabaefe.e05382","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":260,"y":560,"wires":[["24851e03.e8ac82"]]}]

joside avatar Mar 21 '18 10:03 joside

I checked with your token and it works (now I removed from the message), I tried with the last telegram api and it works. I’m sorry I’m out of options.

To exclude a problem with environment you could try locally (not on raspberry) and see if it works (for example a desktop)

Which version of node/node-red?

guidone avatar Mar 21 '18 11:03 guidone

Node-RED version: v0.17.5 Node.js version: v8.9.3 Linux 4.9.59-v7+ arm LE

joside avatar Mar 21 '18 11:03 joside

Node-Red version is quite old, I'm not sure if it matters but it worth upgrading.

I'm out of options here, you could try on a different environment - like desktop - if it works the problem is related to the particular environment. I don't have a Raspberry, so I cannot try myself

guidone avatar Mar 22 '18 08:03 guidone

I have the same issue on my raspberry. Have you find a solution ? My node-red is almost the lastest version v0.18.4

bricegomis avatar May 19 '18 16:05 bricegomis

For future people who will have this error, I managed to fix the problem by updating the request-promise package with these two commands, since more errors :)

npm install --save request
npm install --save request-promise-native

I am still a beginner on nodejs so I would say there was a problem of dependencies, if an expert can explain it, I'm interested.

bricegomis avatar May 19 '18 19:05 bricegomis

i am still having Pull issues at my PC only i have updated Node to latest today version: v0.19.5

i have tried it on a different PC with the same config... same bot working...

aihysp avatar Feb 05 '19 15:02 aihysp

I have exactly the same problem: error: [polling_error] {"code":"EFATAL","message":"EFATAL: Error: connect ENOENT /botxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/getUpdates"}

I'm running NodeRed addon on Hassio so I don't think using npm is an option for me.

CMDR-Sloma avatar Oct 27 '19 04:10 CMDR-Sloma

unfortunately I run into the same error:

error: [polling_error] {"code":"EFATAL","message":"EFATAL: Error: connect ENOENT /bot9999999999:XXXXXXXXXXXXXXX_XXXXXXXX_XXXXXXXXXX/getUpdates"}

Via curl from within the running container I'll get a perfectly fine response from the telegram api.

I'm running the latest Docker image "nodered/node-red:1.0.6-2-12-minimal" which includes the following versions: Node-Red: 1.0.6 node.JS: 12.16.2 npm: 6.14.4 RedBot: 0.18.15

Any hints where to look or what to try?

This is the flow I'm seeing the error - I have nowhere any other Telegram or bot related nodes installed or used: [{"id":"dcc013ba.ec244","type":"tab","label":"Chatbot","disabled":false,"info":""},{"id":"58c71810.227f78","type":"debug","z":"dcc013ba.ec244","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":730,"y":160,"wires":[]},{"id":"f56ce611.3a2ab8","type":"chatbot-telegram-receive","z":"dcc013ba.ec244","bot":"5976917b.28bb9","botProduction":"","x":500,"y":160,"wires":[["58c71810.227f78"]]},{"id":"5976917b.28bb9","type":"chatbot-telegram-node","z":"","botname":"myActualBotUserNameWithoutTheAt","usernames":"","providerToken":"","polling":"1500","store":"81da899e.b55668","log":"","debug":true,"webHook":"","connectMode":"polling"},{"id":"81da899e.b55668","type":"chatbot-context-store","z":"","name":"MyMemoryContext","contextStorage":"memory","contextParams":""}]

kueswol avatar May 23 '20 16:05 kueswol

I had error error: [polling_error] {"code":"EFATAL","message":"EFATAL: Error: unable to verify the first certificate"} I solved it by using VPN

Nova201810 avatar Jun 17 '20 22:06 Nova201810

So what is it??? I have the same issue!

RestOp avatar Nov 20 '20 10:11 RestOp

Sorry guys, I'll merge today, very busy period...

guidone avatar Nov 20 '20 10:11 guidone

@Nova201810, could you please write on my email how exactly you solved the error? I have the same problem and VPN does not help.

rockaxl3 avatar Jun 05 '21 13:06 rockaxl3

did you find the solution?

oballi avatar Aug 11 '21 11:08 oballi