Telegram send, semantic issue?


I've been using this to send telegram images from buffer for years

in the last few days, I can't send this specific msgs, getting this error
Caught exception in sender node:
Error: ETELEGRAM: 400 Bad Request: message to copy not found
when processing message:

I tried anything I could think of, nothing worked.
So I just copied a different format that actually doing the very same

** caption is added as well, just took screenshot before.

and now I'm sending successfully. What the hell is going on ? its exactly the same fields eventually. no ?

Look at your function code. Why are you setting msg.payload.content to msg.payload?

No, feed the first function into a debug node and expand the payload and see what you have in msg.payload.content. You will find it is a circular reference. The reason is that when you say msg.payload.content = msg.payload you are saying set the content property of the payload to contain a reference to the original payload, so the result is that msg.payload.content is a reference to msg.payload, which contains a property content which is a reference to msg.payload which contains a property content which ...

When you use the second format the result is that it makes an object containing the properties chatID, photo and content, where again content is a reference to the original payload. However, because the statement is overwriting the whole of msg.payload it will make a new object for msg.payload to be a reference to. The original msg.payload still has msg.payload.content refering to it so it is not deleted but remains in existence for msg.payload.content to refer to.

Thanks both. I wonder how it worked from first place for ages.
"Get Picture" gets a image from URL and write it to buffer, that buffer is msg.payload.
Should I just add "change" and move msg.payload to msg.payload.content or I can do this smarter in the formula ?

Did it the other way around, not sure why I didn't do that from first place :slight_smile: