windkh / node-red-contrib-telegrambot

Telegram bot nodes for node-red.
Other
262 stars 116 forks source link

Type Photo - undefined #212

Closed dibadodo closed 2 years ago

dibadodo commented 2 years ago

Hello, i'm unable to send a photo. Each time i get this error: TypeError: Cannot read property 'length' of undefined object Thats the msg that i send to send node:

payload: object content: "/tmp/klingel.jpg" chatid: "123456" type: "photo"

Any hint about the problem?

Thank you

windkh commented 2 years ago

Just import the sendPhoto example from the examples folder

dibadodo commented 2 years ago

Thanks for your fast answer but with the sample i got this error:

Caught exception in sender node:Error: EFATAL: Error: read ECONNRESETwhen processing message: {"payload":{"chatId":123456,"messageId":7514,"type":"photo","content":"/tmp/klingel.jpg","caption":"super cool","options":{"caption":"super cool","chat_id":123456,"photo":null}},"originalMessage":{"message_id":.... "date":1631976508,"text":"/foo","entities":[{"offset":0,"length":4,"type":"bot_command"}]},"_msgid":"82662eea.7643"}

windkh commented 2 years ago

??? Error Connection Reset is very strange. How big is the file? Habe you tried another image yet?

Sending text messages work or?

is someting written to the console?

dibadodo commented 2 years ago

the picture have a size of 450kb a other picture with 205b on same directory works

But 450kb should work to. That should not be to large

which console you are meaning? I have no entry in message log

dibadodo commented 2 years ago

i have to correct me. With your example i see this messages inside of message log

Sep 18 19:40:40 homematic-raspi daemon.err node-red: Unhandled rejection RequestError: Error: read ECONNRESET Sep 18 19:40:40 homematic-raspi daemon.err node-red: at new RequestError (/usr/local/addons/redmatic/var/node_modules/node-red-contrib-telegrambot/node_modules/request-promise-core/lib/errors.js:14:15) Sep 18 19:40:40 homematic-raspi daemon.err node-red: at Request.plumbing.callback (/usr/local/addons/redmatic/var/node_modules/node-red-contrib-telegrambot/node_modules/request-promise-core/lib/plumbing.js:87:29) Sep 18 19:40:40 homematic-raspi daemon.err node-red: at Request.RP$callback [as _callback] (/usr/local/addons/redmatic/var/node_modules/node-red-contrib-telegrambot/node_modules/request-promise-core/lib/plumbing.js:46:31) Sep 18 19:40:40 homematic-raspi daemon.err node-red: at self.callback (/usr/local/addons/redmatic/var/node_modules/node-red-contrib-telegrambot/node_modules/request/request.js:185:22) Sep 18 19:40:40 homematic-raspi daemon.err node-red: at Request.emit (events.js:327:22) Sep 18 19:40:40 homematic-raspi daemon.err node-red: at Request.onRequestError (/usr/local/addons/redmatic/var/node_modules/node-red-contrib-telegrambot/node_modules/request/request.js:877:8) Sep 18 19:40:40 homematic-raspi daemon.err node-red: at ClientRequest.emit (events.js:315:20) Sep 18 19:40:40 homematic-raspi daemon.err node-red: at TLSSocket.socketErrorListener (_http_client.js:469:9) Sep 18 19:40:40 homematic-raspi daemon.err node-red: at TLSSocket.emit (events.js:315:20) Sep 18 19:40:40 homematic-raspi daemon.err node-red: at emitErrorNT (internal/streams/destroy.js:106:8) Sep 18 19:40:40 homematic-raspi daemon.err node-red: at emitErrorCloseNT (internal/streams/destroy.js:74:3) Sep 18 19:40:40 homematic-raspi daemon.err node-red: at processTicksAndRejections (internal/process/task_queues.js:80:21)

windkh commented 2 years ago

I guess that photo can be 10MB. Maybe you can send the photo to my email account and then I can check if I can send it. If yes, then therer must be a problem with your setup. If no, then we must have a look at the image …

dibadodo commented 2 years ago

The Image is a picture from IP Cam. When someone use my doorbell the cam take a picture and this picture should be send with telegram. I can send this picture with the normal client. Sometimes it work over the api. One time... Because that I 'm able to send a very small image, a button.png from same system, i think the base setup is ok. But i have no idea where is the problem to send this image. I have tested it with other images, smaller (45 - 160kB) and bigger (2MB) and with other type (png), with the same result.

Regards

windkh commented 2 years ago

Please try to send the image as content without reading from harddisc: see https://discourse.nodered.org/t/taking-a-picture-and-sending-it-via-telegram/27905/4

windkh commented 2 years ago

@dibadodo did you try it out? is this still an issue? can I close it?

dibadodo commented 2 years ago

I have still the problem. A short time i got the images but no more. I don't know why or why not. I have nothing changed. I think it is a timing problem. but for now i have to do some other things. I will try it later again. Think Christmas time is nice for that ;) thank you again for your support and sorry for the delay

windkh commented 2 years ago

no response --> closed