Closed ScheckGuillermo closed 18 hours ago
Hi @ScheckGuillermo!
Thanks for addressing this issue. We agree with you. This is a potential issue. The client project cannot handle this error and it will crash the project. The intention of not handling these errors was to let the client project know directly what error happened with the calls to Keycloak API.
Since the token refresh is not an error the client project can handle, we agree to add a try-catch block within the setInterval.
If you have a handy temporary fix, please don't hesitate to contribute. If not, I will assign this task to @KLloydNA :neckbeard:
Thank you for replying.
Yes, I agree that using a try/catch within the setInterval function ensures that the node app will not end with an unhandled exception.
I have not implemented a temporary fix because I have reported a genuine issue that causes the setInterval to fail, resulting in the entire application failing #42
Will close this one because we have a detailed version of it on #42. 👍
Problem:
In the TokenManager class, there is an issue related to error handling during the token refresh process. Currently, the access token is refreshed at regular intervals using setInterval. However, this process lacks proper error handling. If the refresh request fails (e.g., due to a 400 or 500 response), an unhandled exception is thrown. This can lead to a node unhandledException and potentially cause the entire application to crash.
Temporary Fix
To address the issue temporarily, we can put the refresh request inside a try-catch block within the setInterval. This way, any errors that occur during the token refresh will be caught and handled, preventing the application from crashing due to unhandled exceptions.
Proposed Solutions