jpwsutton / node-red-contrib-surepet

A set of nodes to interact with the Surepet API
Apache License 2.0
2 stars 1 forks source link

Contrib node make Nodered rebooting #1

Closed klose54 closed 1 year ago

klose54 commented 1 year ago

Hello,

I'm using the contrib node in nodered for a while, and after a crash of my setup I had to make a complete fresh new setup with nodered v3.

I deployed a flows backup with the node and the credentials, when using it manually it works as it as always worked, but when i make it work with an inject node with a repeat every second, it makes this error and nodered keeps ketting it and constantly reboot

    Welcome to Node-RED
    26 Mar 11:58:30 - [info] Node-RED version: v3.0.2
    26 Mar 11:58:30 - [info] Node.js version: v16.19.1
    26 Mar 11:58:30 - [info] Linux 6.1.19-v7+ arm LE
    26 Mar 11:58:33 - [info] Loading palette nodes
    26 Mar 11:58:39 - [info] Worldmap version 2.34.0
    26 Mar 11:58:40 - [info] Dashboard version 3.4.0 started at /ui
    26 Mar 11:58:40 - [info] Settings file : /home/klose54/.node-red/settings.js
    26 Mar 11:58:40 - [info] Context store : 'default' [module=memory]
    26 Mar 11:58:40 - [info] User directory : /home/klose54/.node-red
    26 Mar 11:58:40 - [warn] Projects disabled : editorTheme.projects.enabled=false
    26 Mar 11:58:40 - [info] Flows file : /home/klose54/.node-red/flows.json
    26 Mar 11:58:40 - [info] Server now running at http://127.0.0.1:1880/
    26 Mar 11:58:40 - [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.

    26 Mar 11:58:44 - [info] Starting flows
    26 Mar 11:58:44 - [info] [surepet-credentials:b5cc3c783ef12564] We have a username and password, attempting to authenticiate.
Uncaught Exception:
26 Mar 11:59:16 - [error] Error: Get state failed: unauthenticated
at SurePetCareClient.getState (/home/klose54/.node-red/node_modules/sure-pet-care-client/dist/client.js:39:31)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Steve-Mcl commented 1 year ago

See this thread for details: https://discourse.nodered.org/t/nodered-keeps-restarting-with-processticksandrejections-error/76956/4?u=steve-mcl

klose54 commented 1 year ago

So after delaying the node call for a few seconds after the flow starts, I do not have this error anymore but I have this 👍 [red] ```

Uncaught Exception:
[error] Error: Get state failed: received 504 Gateway Time-out
    at SurePetCareClient.getState (/home/klose54/.node-red/node_modules/sure-pet-care-client/dist/client.js:41:31)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

I do believe that this could be caused by a server fault on the surepet side, but maybe there is something missing for nodejs v16 that would handle a server error and not crash nodered ?

klose54 commented 1 year ago

Edits in a fork with the changes thanks to @Steve-Mcl