Error with Immutable Headers in Better Auth Session Middleware on Deno Server
Guys
Hello ,
I’m working on setting up session management using Better Auth with a Deno server and Hono as the framework. I followed the documentation to create a middleware for session handling, but I'm running into an issue when trying to retrieve sessions.
Here’s a simplified version of my code:
Issue Details
Upon running the server, I receive the following error:
The error occurs when the
getSession method is called, indicating that headers are treated as immutable. I attempted the workaround of using raw headers directly from c.req.raw.headers, but this hasn’t resolved the issue.Environment
- Deno: 2.0.2
- Better Auth: v0.6.2
- Hono: v4.6.8
