[PR #2451] [CLOSED] docs(error-handling): added error message when next.js tries to set cookies in a RSC or other enviroments where cookies() is read-only. #29927

Closed
opened 2026-04-17 21:10:14 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/2451
Author: @drago1520
Created: 4/26/2025
Status: Closed

Base: mainHead: fix(nextCookies)/error-handling-RSC


📝 Commits (4)

  • 2fe81ca docs(error-handling): added error message when next.js tries to set cookies in a RSC or other enviroments where cookies() is read-only.
  • 48bb2d5 chore: added the catched error.
  • 75d44f8 chore: fixed my stupid typo
  • 1c110d7 chore: passing the catched error as a separate argument to the ctx logger

📊 Changes

1 file changed (+1 additions, -0 deletions)

View changed files

📝 packages/better-auth/src/integrations/next-js.ts (+1 -0)

📄 Description

Currently, setting a cookie in a read-only cookie enviroment fails silently, which is horrible. The Client is out of sync of the database and you have no idea why.

I had this problem and wasted 6 days working on it. It would save me all this time if I just had this error handling.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/2451 **Author:** [@drago1520](https://github.com/drago1520) **Created:** 4/26/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix(nextCookies)/error-handling-RSC` --- ### 📝 Commits (4) - [`2fe81ca`](https://github.com/better-auth/better-auth/commit/2fe81ca6b2d4495e50755c44872d0722c9eea5c4) docs(error-handling): added error message when next.js tries to set cookies in a RSC or other enviroments where cookies() is read-only. - [`48bb2d5`](https://github.com/better-auth/better-auth/commit/48bb2d5f5ae920d9d4c09e249f7142f321cec1ae) chore: added the catched error. - [`75d44f8`](https://github.com/better-auth/better-auth/commit/75d44f8b298d6f2a2ae887a37a6449b54afc2b7d) chore: fixed my stupid typo - [`1c110d7`](https://github.com/better-auth/better-auth/commit/1c110d757549a8075f540f313be5979ab3966b99) chore: passing the catched error as a separate argument to the ctx logger ### 📊 Changes **1 file changed** (+1 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/integrations/next-js.ts` (+1 -0) </details> ### 📄 Description Currently, setting a cookie in a read-only cookie enviroment fails silently, which is horrible. The Client is out of sync of the database and you have no idea why. I had this problem and wasted 6 days working on it. It would save me all this time if I just had this error handling. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-17 21:10:14 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#29927