Compare commits

..

4 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
Balázs Orbán
362e981e6d chore(release): bump package version(s) [skip ci] 2022-11-06 06:07:47 +01:00
Balázs Orbán
5198eb19f7 fix(next): build RSC+unstable_getServerSession 2022-11-06 05:53:38 +01:00
2 changed files with 3 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "next-auth",
"version": "4.16.0",
"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,13 +172,3 @@ declare global {
}
}
}
function ensureAvailable(fn: () => any) {
try {
return fn()
} catch (error) {
throw new Error(
`Could not access ${fn.name}(). If you are not in a React Server Cmponent, pass the request and response.`
)
}
}