Markoudstaal / node-red-contrib-discord-advanced

Recieve, send, edit and delete Discord messages in node-red.
MIT License
46 stars 16 forks source link

invalid token causes nodered to get stuck in crash loop #28

Closed edwmurph closed 2 years ago

edwmurph commented 2 years ago

i added the palette correctly and everything was functioning up until the point when i deployed a discordMessageManager node with a bad token and then my node-red container got stuck in a crash loop

i had to temporarily update my nodered container to an ubuntu image to get it out of the crash loop and then manually remove the token from the flows.json because the flows.json file is in a persistent volume in a kubernetes cluster ``` image: ubuntu command: [ "/bin/bash", "-c", "--" ] args: [ "while true; do sleep 30; done;" ] # image: nodered/node-red:latest-16 ```

but it would be ideal if a bad token didn't cause the nodered container to get into a crash loop state so i could fix it from the nodered UI

container logs ``` > node-red-docker@2.2.2 start > node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data" 17 May 21:32:13 - [info] Welcome to Node-RED =================== 17 May 21:32:13 - [info] Node-RED version: v2.2.2 17 May 21:32:13 - [info] Node.js version: v16.13.1 17 May 21:32:13 - [info] Linux 5.4.0-1059-raspi arm64 LE 17 May 21:32:14 - [info] Loading palette nodes 17 May 21:32:22 - [info] Settings file : /data/settings.js 17 May 21:32:22 - [info] Context store : 'default' [module=memory] 17 May 21:32:22 - [info] User directory : /data 17 May 21:32:22 - [warn] Projects disabled : editorTheme.projects.enabled=false 17 May 21:32:22 - [info] Flows file : /data/flows.json 17 May 21:32:22 - [info] Server now running at http://127.0.0.1:1880/ 17 May 21:32:22 - [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. --------------------------------------------------------------------- 17 May 21:32:22 - [info] Starting flows 17 May 21:32:23 - [info] Started flows 17 May 21:32:23 - [info] [server:Home Assistant] Connecting to http://homeassistant-tcp.home.svc.cluster.local Error [TOKEN_INVALID]: An invalid token was provided. at WebSocketManager.connect (/data/node_modules/discord.js/src/client/websocket/WebSocketManager.js:129:26) at Client.login (/data/node_modules/discord.js/src/client/Client.js:254:21) at /data/node_modules/node-red-contrib-discord-advanced/discord/lib/discordBotManager.js:28:11 at new Promise () at Object.getBot (/data/node_modules/node-red-contrib-discord-advanced/discord/lib/discordBotManager.js:9:17) at new discordMessageManager (/data/node_modules/node-red-contrib-discord-advanced/discord/discordMessageManager.js:19:23) at Object.createNode (/usr/src/node-red/node_modules/@node-red/runtime/lib/flows/util.js:90:27) at Flow.start (/usr/src/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:206:48) at start (/usr/src/node-red/node_modules/@node-red/runtime/lib/flows/index.js:371:33) { [Symbol(code)]: 'TOKEN_INVALID' } 17 May 21:32:23 - [red] Uncaught Exception: 17 May 21:32:23 - [error] ReferenceError: setError is not defined at /data/node_modules/node-red-contrib-discord-advanced/discord/discordMessageManager.js:253:7 at processTicksAndRejections (node:internal/process/task_queues:96:5) ```
javis86 commented 2 years ago

It will fix in the next minor version, thanks for the feedback.