Admin Plugin - Issue with cookie cache and secondary storage not updating on `auth.api.setRole` call
I'm encountering a problem with cookie cache and secondary storage behavior when updating user roles using
Issue description:
auth.api.setRole in my Remix+Better-Auth project.Issue description:
- When I call
auth.api.setRoleto update a user's role (e.g., promote a user to "admin" or revert them), the response headers do not include anySet-Cookieheaders. Example response headers look like this: - Because of this, the cookie session does not update on the client side.
- In my Cloudflare KV store (which is configured as the
secondaryStoragefor Better-Auth), the user data appears duplicated rather than updated properly. I assume the KV data is supposed to be tied to the session cookie. - This leads to inconsistent state where I can promote a user to admin and then when logged in as a "member", change them back to admin again, since cookie cache and secondary storage aren't working properly.
- Even when I forcibly disable cookie cache like this:
the problem persists.


