NodeRed loses connection to OpenCore Mongo?

Hi,

I didnt know exactly how to call this question. We have a problem right now where we have a nodeRed that periodically checks the MongoDb of openCore if all workitems of a certain type are done and if not goes into a delay waiting for the next check. This can take an hour or more in some cases. After a while the whole message disapears since it got caught to often with the following error.

It looks to me like the JWT token of the message runs out and does not refresh itself? Is there anything i can do to prevent this?

10 Jan 17:26:53 - [error] [api get:af807d6f220a4497] ServerError: Discard query due to missing jwt, and respond with error, for client at 172.18.0.17 nodered 1.5.11
10 Jan 17:26:53 - [warn] [api get:af807d6f220a4497] Message exceeded maximum number of catches
[client][ERR] Discard query due to missing jwt, and respond with error, for client at 172.18.0.17 nodered 1.5.11
[client][ERR] Discard query due to missing jwt, and respond with error, for client at 172.18.0.17 nodered 1.5.11
[client][ERR] Discard query due to missing jwt, and respond with error, for client at 172.18.0.17 nodered 1.5.11
[client][ERR] Discard query due to missing jwt, and respond with error, for client at 172.18.0.17 nodered 1.5.11
[client][ERR] Discard query due to missing jwt, and respond with error, for client at 172.18.0.17 nodered 1.5.11
[client][ERR] Discard query due to missing jwt, and respond with error, for client at 172.18.0.17 nodered 1.5.11
[client][ERR] Discard query due to missing jwt, and respond with error, for client at 172.18.0.17 nodered 1.5.11
[client][ERR] Discard query due to missing jwt, and respond with error, for client at 172.18.0.17 nodered 1.5.11
[client][ERR] Discard query due to missing jwt, and respond with error, for client at 172.18.0.17 nodered 1.5.11
[client][ERR] Discard query due to missing jwt, and respond with error, for client at 172.18.0.17 nodered 1.5.11
[client][INF] setting, skip 68da62dc3d43cb4641a885eb is same version 22
[client][INF] setting - 5:19:00 PM
[client][INF] 5:19:00 PM
eyJhbGc……….

Are you using the token NodeRED runs with (i.e., you are not setting a token anywhere) or did you request a token (for instance, by using the Get JWT node)?

If the first, do you see a msg.jwt at some point? Try adding a debug node at different points, and check if you get a msg.jwt set at some point (some types of nodes will return a msg.jwt if they talk to message queues), and if that is the case, try deleting it. This should force all nodes to use the current valid token for NodeRED.

Yes, all tokens will expire after 5 minutes by default. When a client signs in, OpenCore sends a refresh token to the client, and this is the token used for all requests. OpenCore sends a fresh token one minute before it expires automatically, but if you store the refresh token and keep using it, it will be rejected. So two “workarounds” to fix it here and now could be to allow expired tokens allow_signin_with_expired_jwt or to make all tokens last much longer by setting shorttoken_expires_in and downloadtoken_expires_in as mentioned here: Configuration Values | OpenIAP Documentation

There is no jwt set in the msg object here a screenshot of the process. It loops inside the red circle until it throws the error above. And aborts after a few retries.

image

and workflow in uses the message queue, so it sets a msg.jwt

ahhhh thats why i could not reproduce it in manual tests. So is the solution her to clear msg.jwt after the workflow in?

Yeah, just add a function node between workflow in and api get with

delete msg.jwt;
return msg;

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.