Better Auth Error Session data is too large to store in the cookie
I'm always getting this error whenever I tried to sign up.
Here's my
auth instance
Solution:Jump to solution
This occurs because the base64 of the profile picture is too large. You should upload the profile picture to a S3 bucket or cloudflare R2 and save only the id to the database / cookie
3 Replies
Solution
This occurs because the base64 of the profile picture is too large. You should upload the profile picture to a S3 bucket or cloudflare R2 and save only the id to the database / cookie
thank you so much, how did you know the profile picture is causing of this error? because you are correct I just converting the image into base64 for testing
Once had the same issue, glad I could help you. Base64 is maybe the only reason a cookie can exceed the max size of 4096 bytes so it was likely the same issues what I had in the past. I recommend cloudflare btw. Just nice and for most use cases for free