[PR #296] [MERGED] Use await in the next/headers to prevent errors #3213

Closed
opened 2026-03-13 10:43:50 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/296
Author: @mmikhan
Created: 10/22/2024
Status: Merged
Merged: 10/22/2024
Merged by: @Bekacru

Base: mainHead: patch-1


📝 Commits (1)

  • 46dabb7 Use await in the next/headers to prevent errors

📊 Changes

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

View changed files

📝 docs/content/docs/basic-usage.mdx (+1 -1)

📄 Description

We need to use await on the next/headers since headers() returns a promise. Directly accessing it shows an error in the console.

Error: In route / a header property was accessed directly with `headers().get('cookie')`. `headers()` should be awaited before using its value. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis

🔄 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/296 **Author:** [@mmikhan](https://github.com/mmikhan) **Created:** 10/22/2024 **Status:** ✅ Merged **Merged:** 10/22/2024 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `patch-1` --- ### 📝 Commits (1) - [`46dabb7`](https://github.com/better-auth/better-auth/commit/46dabb77afd5deeac734558627f74bc56ca246bc) Use `await` in the `next/headers` to prevent errors ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/basic-usage.mdx` (+1 -1) </details> ### 📄 Description We need to use `await` on the `next/headers` since `headers()` returns a promise. Directly accessing it shows an error in the console. ```bash Error: In route / a header property was accessed directly with `headers().get('cookie')`. `headers()` should be awaited before using its value. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis ``` --- <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-03-13 10:43:50 -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#3213