I’m using node-red-contrib-telegrambot to send simple messages to Telegram chats.
The issue I’m facing is that the bot token in the configuration node does not persist.
After I set the correct token in the configuration, the node works for a while. But after a few days, the token field is cleared automatically. When this happens, the bot stops working, and I have to re-enter the token in the properties panel and deploy again.
I’m not sure what causes this. Maybe Node-RED restarts or reloads and the token gets lost, but I really don’t know.
Question:
How can I prevent this from happening and make sure the token is stored permanently?
I have node red as docker container installed. And here are the settings;
~ $ node-red -v
28 Aug 20:46:26 - [info]
Welcome to Node-RED
28 Aug 20:46:26 - [info] Node-RED version: v4.0.8
28 Aug 20:46:26 - [info] Node.js version: v20.18.2
28 Aug 20:46:26 - [info] Linux 5.15.0-126-generic x64 LE
28 Aug 20:46:26 - [info] Loading palette nodes
28 Aug 20:46:27 - [info] Settings file : /usr/src/node-red/.node-red/settings.js
28 Aug 20:46:27 - [info] Context store : 'default' [module=memory]
28 Aug 20:46:27 - [info] User directory : /usr/src/node-red/.node-red
28 Aug 20:46:27 - [warn] Projects disabled : editorTheme.projects.enabled=false
28 Aug 20:46:27 - [info] Flows file : /usr/src/node-red/.node-red/flows.json
28 Aug 20:46:27 - [info] Creating new flow file
28 Aug 20:46:27 - [warn]
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
28 Aug 20:46:27 - [error] Unable to listen on http://127.0.0.1:1880/
28 Aug 20:46:27 - [error] Error: port in use
Seems to me that you might have 2 instances of Node-RED fighting each other. I think that is going to be the problem because that node has worked flawlessly for me for years now.
Is it a healty output for not having the same port on usage?
root@ubuntu:~# docker logs -f nodered
28 Aug 20:37:18 - [info]
Welcome to Node-RED
28 Aug 20:37:18 - [info] Node-RED version: v4.0.8
28 Aug 20:37:18 - [info] Node.js version: v20.18.2
28 Aug 20:37:18 - [info] Linux 5.15.0-126-generic x64 LE
28 Aug 20:37:18 - [info] Loading palette nodes
28 Aug 20:37:19 - [info] node-red-contrib-telegrambot version: v16.1.3
28 Aug 20:37:19 - [warn] ------------------------------------------------------
28 Aug 20:37:19 - [warn] [node-red-contrib-playwright/playwright] ReferenceError: Cannot access 'REDAPI' before initialization
28 Aug 20:37:19 - [warn] ------------------------------------------------------
28 Aug 20:37:19 - [info] Settings file : /data/settings.js
28 Aug 20:37:19 - [info] HTTP Static : /data/static > /
28 Aug 20:37:19 - [info] Context store : 'memoryOnly' [module=memory]
28 Aug 20:37:19 - [info] Context store : 'file' [module=localfilesystem]
28 Aug 20:37:19 - [info] User directory : /data
28 Aug 20:37:19 - [warn] Projects disabled : editorTheme.projects.enabled=false
28 Aug 20:37:19 - [info] Flows file : /data/flows.json
28 Aug 20:37:19 - [info] Server now running at http://127.0.0.1:1880/
28 Aug 20:37:19 - [warn]
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
28 Aug 20:37:19 - [info] Starting flows
28 Aug 20:37:19 - [info] Started flows
You cannot have 2 instances of node-red on the same IP address/port, that is a web server limitation. You must change the port for one of them. Note that if both instances are inside their own separate containers, the internal ports CAN be the same, only the way that the host sees them has to be different.
Docker configuration allows you to map internal to external ports so you can easily choose any port you like on the host end of things. However, you should always use a port >1024 for security. If you absolutely must have lower numbered ports - the default 80 or 443 for example, map those using a separate proxy service.