BetterAuthError [BetterAuthError: Session data is too large

Get the following error when using cookie cache with Microsoft OAuth.
BetterAuthError [BetterAuthError: Session data is too large to store in the cookie. Please disable session cookie caching or reduce the size of the session data] Not an issue for users who log in without an image on their Microsoft account. it would seem that the image which is base64 encoded causes the session data which includes sesssion and user to be over 4093
No description
3 Replies
Ping
Ping2w ago
Yeah, not sure if you can do much about this one. Unless you want to implement a system which converts base64 imgs to png or something and save it in a DB like s3 yourself, then set the img url to your s3 user img url
bwhitney
bwhitneyOP2w ago
Curious where the 4093 number comes from? why 4093. Should this be a const or configurable item. is there a way to stop the image being included in the cache cookie
Netrifier
Netrifier2w ago
The cookies have a limit of 4kb data that can be stored in them I don't think this is currently possible. I did try modifying the get-session endpoint directly and then setting the cookie there with my modified data, but the internal getSession function is called in a lot of places which sets the cookie so that can't be changed as of now

Did you find this page helpful?