Skip to content

Commit a6fb756

Browse files
committed
fix(getPayloadSession): Don't pass readonly headers object directly to fetch function (#33)
1 parent 357becd commit a6fb756

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/payload-authjs/src/payload/session/getPayloadSession.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ export const getPayloadSession = cache(
3939
const serverUrl = await getServerUrl();
4040

4141
// Fetch the session from the server
42+
const requestHeaders = await headers();
4243
const response = await fetch(`${serverUrl}/api/${userCollectionSlug}/me`, {
43-
headers: await headers(),
44+
headers: new Headers({
45+
cookie: requestHeaders.get("cookie") ?? "",
46+
}),
4447
cache: "force-cache",
4548
next: {
4649
tags: ["payload-session"],

0 commit comments

Comments
 (0)