Skip to content

Commit 6126ba9

Browse files
authored
unstable_getServerAuthSession -> getServerAuthSession (#143)
1 parent 0123ef9 commit 6126ba9

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
// Wrapper for unstable_getServerSession https://next-auth.js.org/configuration/nextjs
2-
31
import type { GetServerSidePropsContext } from "next";
4-
import { unstable_getServerSession } from "next-auth";
2+
import { getServerSession } from "next-auth";
53
import { authOptions as nextAuthOptions } from "../../pages/api/auth/[...nextauth]";
64

75
// Next API route example - /pages/api/restricted.ts
86
export const getServerAuthSession = async (ctx: {
97
req: GetServerSidePropsContext["req"];
108
res: GetServerSidePropsContext["res"];
119
}) => {
12-
return await unstable_getServerSession(ctx.req, ctx.res, nextAuthOptions);
10+
return getServerSession(ctx.req, ctx.res, nextAuthOptions);
1311
};

src/server/trpc/context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const createContextInner = async (opts: CreateContextOptions) => {
2727
export const createContext = async (opts: CreateNextContextOptions) => {
2828
const { req, res } = opts;
2929

30-
// Get the session from the server using the unstable_getServerSession wrapper function
30+
// Get the session from the server using the getServerSession wrapper function
3131
const session = await getServerAuthSession({ req, res });
3232

3333
return await createContextInner({

0 commit comments

Comments
 (0)