plankanban / planka

The realtime kanban board for workgroups built with React and Redux.
https://planka.app
GNU Affero General Public License v3.0
8.11k stars 763 forks source link

fix: Lazy initialize OIDC client #947

Closed darktohka closed 1 week ago

darktohka commented 1 week ago

Sometimes, Planka might boot before the OIDC server is ready to respond. In this case the bootup will freeze with an error:

planka-1         |2024-11-18 08:01:14 [E] Failed to lift app: Error: getaddrinfo ENOTFOUND auth.tohka.us

In this state the server is not "running", but it also does not exit, leading to a server hang.

Instead, create the client on first OIDC request (lazy loading). If the OIDC client communication fails, the server will still be running but OIDC related requests (login, configuration) will fail with a 500 Internal Server Error and a log explaining the OIDC error:

planka-1         |2024-11-18 09:06:39 [W] Error while initializing OIDC client: Error: getaddrinfo ENOTFOUND auth.tohka.us
planka-1         |2024-11-18 09:06:39 [E] Sending 500 ("Server Error") response

This ensures that users who are already logged in can continue to use Planka, and the client will be created automatically when the OIDC client starts back up again and a request to use OIDC is sent.

CLAassistant commented 1 week ago

CLA assistant check
All committers have signed the CLA.

meltyshev commented 1 week ago

Thanks for the fix 🙏