-
Notifications
You must be signed in to change notification settings - Fork 440
Open
Labels
Description
Describe the bug
Description:
While using the keycloak-connect middleware, I encountered the following error:
TypeError: Cannot read properties of undefined (reading "keycloak-token").
Error Stack:
TypeError: Cannot read properties of undefined(reading & #39; keycloak - token & #39;);
at SessionStore.get(/ path / to / project / node_modules / keycloak - connect / stores / session - store.js: 24 : 58);
at Keycloak.getGrant(/ path / to / project / node_modules / keycloak - connect / keycloak.js: 311 : 30);
at grantAttacher(/ path / to / project / node_modules / keycloak - connect / middleware / grant - attacher.js: 20 : 14);
at Layer.handle[as handle_request](/ path / to / project / node_modules / express / lib / router / layer.js: 95 : 5);
at trim_prefix(/ path / to / project / node_modules / express / lib / router / index.js: 328 : 13);
at / path / to / project / node_modules / express / lib / router / index.js: 286 : 9;
at Function.process_params(/ path / to / project / node_modules / express / lib / router / index.js: 346 : 12);
at next(/ path / to / project / node_modules / express / lib / router / index.js: 280 : 10);
at adminRequest(/ path / to / project / node_modules / keycloak - connect / middleware / admin.js: 119 : 16);
at Layer.handle[as handle_request](/ path / to / project / node_modules / express / lib / router / layer.js: 95 : 5)
Version
26.1.1
Expected behavior
The code should not throw the exception if request.session is undefined
Actual behavior
The error TypeError: Cannot read properties of undefined (reading "keycloak-token") is thrown.
How to Reproduce?
No response
Anything else?
Environment Information:
Node.js Version: v22.9.0
Express Version: 4.21.2