-
Notifications
You must be signed in to change notification settings - Fork 175
Open
Description
When using getUserSession(event) inside a cachedEventHandler, the returned session object only includes the id:
// inside cachedEventHandler
const session = await getUserSession(event);
console.log(session);
// Output: { id: '99ca50c6-297f-429c-8f53-5903d6ecd74b' }However, in defineEventHandler, the same call returns the full session with the user object populated:
// inside defineEventHandler
const session = await getUserSession(event);
console.log(session);
// Output includes: session.user = { id, username, roles, etc. }Expected Behavior
Calling getUserSession(event) should return the same structure and data, regardless of whether the handler is wrapped in defineEventHandler or cachedEventHandler.
Actual Behavior
-
In
cachedEventHandler,session.useris missing. -
In
defineEventHandler,session.useris present.
Notes
-
We're not caching session data.
-
Session is being retrieved solely to enrich or filter unrelated cached data.
-
The inconsistency leads to partial functionality or the need for workarounds.
Metadata
Metadata
Assignees
Labels
No labels