windkh / node-red-contrib-telegrambot

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

Unexpected behavior when deploying only the modified flows #197

Closed xoancosmed closed 3 years ago

xoancosmed commented 3 years ago

I'm used to use the "Modified Flows" option when deploying my flows in Node-RED. However, if I do this after adding a new receiver (or command) node, this makes the older receiver (or command) nodes to stop working.

I don't think this is a critical issue, as to fix it is enough to stop using the "Modified Flows" option when deploying your flow changes, but I didn't see the issue mentioned anywhere in the documentation. Is this a known issue? Is expected to be fixed? If so, I think it should be added to the documentation (I can create a PR).

My apologies if this is not the right place to discuss this. And thank you very much for taking your time in reading this note.

How to reproduce

1) Create a fresh Node-RED instance:

   docker run -it -p 1880:1880 --name mynodered nodered/node-red

2) Install the node-red-contrib-telegrambot palette:

   "dependencies": {
       "node-red-contrib-telegrambot": "~10.0.4"
   }

3) Create a testing bot using @BotFather:

   /newbot
   (Send a name for the bot)
   (Send the alias of the bot)
   (Copy the bot token)

4) In the Node-RED flow, add a command node, doble clic on it and add the bot settings:

Captura de pantalla 2021-08-02 a las 20 19 56

5) Save the changes and write the command that node will handle:

Captura de pantalla 2021-08-02 a las 20 20 31

6) Add a debug node to the first output of the command node:

Captura de pantalla 2021-08-02 a las 20 26 28

7) Make the first deploy:

Captura de pantalla 2021-08-02 a las 20 26 48

8) Add a second command node with a different command:

Captura de pantalla 2021-08-02 a las 20 21 46

9) Add debug nodes to the first output of the new command node:

Captura de pantalla 2021-08-02 a las 20 28 53

10) Deploy using the "Modified Flows" option:

Captura de pantalla 2021-08-02 a las 20 29 01

11) Test sending messages to the bot:

A) If you send `/world`, the last command we deployed, you'll see the messaged printed in the debug window.
B) If you send `/hello`, the first command we deployed, you won't see anything in Node-RED's debug window. 

My testing setup

I tested it in both a Respberry Pi 4 (Node-RED comes pre-installed; using the latest Node stable version) and using the official Docker image. Using node-red-contrib-telegrambot version 10.0.4 in both scenarios.

In case it depends, my web browser is Firefox 89.0.2 (in macOS and Manjaro).

windkh commented 3 years ago

Yes that is a known issue for ages. However I can not really tell you why it occurs. Maybe I should just try to debug that once again…. in the meantime extending the readme with a hint would be a useful alternative

windkh commented 3 years ago

I improved some register/unregister-event things inside the command nodes. In addition to that I tried to reproduce your scenario. At least on my machine it sseems to work. @xoancosmed can you test that for me on your machine?

Should work in 10.0.5 (hopefully :) )

xoancosmed commented 3 years ago

Good afternoon. Sorry for the delay. I've being testing it several time and now seems to work perfectly for me using the partial deploy. Thank very much your help and time.

windkh commented 3 years ago

@xoancosmed ah cool!