Compare commits

...

2 Commits

Author SHA1 Message Date
Balázs Orbán
52a2bf3e28 chore(release): bump package version(s) [skip ci] 2022-11-06 06:24:30 +01:00
Balázs Orbán
180c6252d9 fix(next): build RSC+unstable_getServerSession 2022-11-06 06:09:27 +01:00
2 changed files with 3 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "next-auth",
"version": "4.16.1",
"version": "4.16.2",
"description": "Authentication for Next.js",
"homepage": "https://next-auth.js.org",
"repository": "https://github.com/nextauthjs/next-auth.git",

View File

@@ -124,8 +124,8 @@ export async function unstable_getServerSession(
const [req, res, options] = isRSC
? [
{
headers: ensureAvailable(headers),
cookies: ensureAvailable(nextCookies)
headers: headers(),
cookies: nextCookies()
.getAll()
.reduce((acc, c) => ({ ...acc, [c.name]: c.value }), {}),
} as any,
@@ -172,15 +172,3 @@ declare global {
}
}
}
function ensureAvailable(fn: () => any) {
try {
return fn()
} catch (error) {
console.error(error)
console.error(
`Could not access ${fn.name}(). If you are not in a React Server Cmponent, pass the request and response.`
)
// Cannot throw since Next.js expects DynamicServerError
}
}