Closed theosanderson closed 8 months ago
@fengelniederhammer also hit this today:
TypeError: Cannot read properties of undefined (reading 'isLoggedIn')
at file:///app/dist/server/chunks/pages/404_d4dab6a9.mjs:1965:44
at AstroComponentInstance.Navigation [as factory] (file:///app/dist/server/chunks/astro_7796fbdb.mjs:312:12)
at AstroComponentInstance.init (file:///app/dist/server/chunks/astro_7796fbdb.mjs:1121:29)
at AstroComponentInstance.render (file:///app/dist/server/chunks/astro_7796fbdb.mjs:1126:18)
at Object.render (file:///app/dist/server/chunks/astro_7796fbdb.mjs:1644:22)
at renderChild (file:///app/dist/server/chunks/astro_7796fbdb.mjs:1077:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
{"instance":"LoginMiddleware","level":"debug","message":"Trying to get token and user info from cookie","timestamp":"2024-03-04T10:53:11.676Z"}
{"instance":"LoginMiddleware","level":"debug","message":"Trying to get token and user info from params","timestamp":"2024-03-04T10:53:11.677Z"}
{"instance":"LoginMiddleware","level":"info","message":"Getting keycloak client for issuer url: http://loculus-keycloak-service:8083/realms/loculusRealm","timestamp":"2024-03-04T10:53:11.677Z"}
10:53:11 AM [ssr] Error: connect ECONNREFUSED 10.43.147.135:8083
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) (x2)
{"instance":"LoginMiddleware","level":"debug","message":"Trying to get token and user info from cookie","timestamp":"2024-03-04T10:53:11.684Z"}
{"instance":"LoginMiddleware","level":"debug","message":"Trying to get token and user info from params","timestamp":"2024-03-04T10:53:11.685Z"}
{"instance":"LoginMiddleware","level":"info","message":"Getting keycloak client for issuer url: http://loculus-keycloak-service:8083/realms/loculusRealm","timestamp":"2024-03-04T10:53:11.685Z"}
TypeError: Cannot read properties of undefined (reading 'isLoggedIn')
at file:///app/dist/server/chunks/pages/404_d4dab6a9.mjs:1965:44
at AstroComponentInstance.Navigation [as factory] (file:///app/dist/server/chunks/astro_7796fbdb.mjs:312:12)
at AstroComponentInstance.init (file:///app/dist/server/chunks/astro_7796fbdb.mjs:1121:29)
at AstroComponentInstance.render (file:///app/dist/server/chunks/astro_7796fbdb.mjs:1126:18)
at Object.render (file:///app/dist/server/chunks/astro_7796fbdb.mjs:1644:22)
at renderChild (file:///app/dist/server/chunks/astro_7796fbdb.mjs:1077:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
file:///app/dist/server/chunks/pages/404_d4dab6a9.mjs:1965
const isLoggedIn = Astro2.locals.session.isLoggedIn;
^
TypeError: Cannot read properties of undefined (reading 'isLoggedIn')
at file:///app/dist/server/chunks/pages/404_d4dab6a9.mjs:1965:44
at AstroComponentInstance.Navigation [as factory] (file:///app/dist/server/chunks/astro_7796fbdb.mjs:312:12)
at AstroComponentInstance.init (file:///app/dist/server/chunks/astro_7796fbdb.mjs:1121:29)
at AstroComponentInstance.render (file:///app/dist/server/chunks/astro_7796fbdb.mjs:1126:18)
at Object.render (file:///app/dist/server/chunks/astro_7796fbdb.mjs:1644:22)
at renderChild (file:///app/dist/server/chunks/astro_7796fbdb.mjs:1077:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Looks like session is not always there, when keycloak fails. So we should properly catch errors and log instead of crash.
Astro logs can read:
This indicates we're not appropriately checking for the possibility of unset Astro session if keycloak can't be talked to