Skip to content

Commit c142413

Browse files
committed
chore(dev): don't load all adapters in dev app
1 parent f2a0793 commit c142413

File tree

1 file changed

+30
-43
lines changed

1 file changed

+30
-43
lines changed

apps/dev/pages/api/auth/[...nextauth].ts

Lines changed: 30 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -37,52 +37,39 @@ import Vk from "next-auth/providers/vk"
3737
import Wikimedia from "next-auth/providers/wikimedia"
3838
import WorkOS from "next-auth/providers/workos"
3939

40-
// Adapters
41-
import { PrismaClient } from "@prisma/client"
42-
import { PrismaAdapter } from "@next-auth/prisma-adapter"
43-
import { Client as FaunaClient } from "faunadb"
44-
import { FaunaAdapter } from "@next-auth/fauna-adapter"
45-
import { TypeORMLegacyAdapter } from "@next-auth/typeorm-legacy-adapter"
46-
import { SupabaseAdapter } from "@next-auth/supabase-adapter"
40+
// // Prisma
41+
// import { PrismaClient } from "@prisma/client"
42+
// import { PrismaAdapter } from "@next-auth/prisma-adapter"
43+
// const client = globalThis.prisma || new PrismaClient()
44+
// if (process.env.NODE_ENV !== "production") globalThis.prisma = client
45+
// const adapter = PrismaAdapter(client)
4746

48-
// Add an adapter you want to test here.
49-
const adapters = {
50-
prisma() {
51-
const client = globalThis.prisma || new PrismaClient()
52-
if (process.env.NODE_ENV !== "production") globalThis.prisma = client
53-
return PrismaAdapter(client)
54-
},
55-
typeorm() {
56-
return TypeORMLegacyAdapter({
57-
type: "sqlite",
58-
name: "next-auth-test-memory",
59-
database: "./typeorm/dev.db",
60-
synchronize: true,
61-
})
62-
},
63-
fauna() {
64-
const client =
65-
globalThis.fauna ||
66-
new FaunaClient({
67-
secret: process.env.FAUNA_SECRET,
68-
domain: process.env.FAUNA_DOMAIN,
69-
})
70-
if (process.env.NODE_ENV !== "production") global.fauna = client
71-
return FaunaAdapter(client)
72-
},
73-
supabase() {
74-
return SupabaseAdapter({
75-
url: process.env.NEXT_PUBLIC_SUPABASE_URL,
76-
secret: process.env.SUPABASE_SERVICE_ROLE_KEY,
77-
})
78-
},
79-
noop() {
80-
return undefined
81-
},
82-
}
47+
// // Fauna
48+
// import { Client as FaunaClient } from "faunadb"
49+
// import { FaunaAdapter } from "@next-auth/fauna-adapter"
50+
// const opts = { secret: process.env.FAUNA_SECRET, domain: process.env.FAUNA_DOMAIN }
51+
// const client = globalThis.fauna || new FaunaClient(opts)
52+
// if (process.env.NODE_ENV !== "production") globalThis.fauna = client
53+
// const adapter = FaunaAdapter(client)
54+
55+
// // TypeORM
56+
// import { TypeORMLegacyAdapter } from "@next-auth/typeorm-legacy-adapter"
57+
// const adapter = TypeORMLegacyAdapter({
58+
// type: "sqlite",
59+
// name: "next-auth-test-memory",
60+
// database: "./typeorm/dev.db",
61+
// synchronize: true,
62+
// })
63+
64+
// // Supabase
65+
// import { SupabaseAdapter } from "@next-auth/supabase-adapter"
66+
// const adapter = SupabaseAdapter({
67+
// url: process.env.NEXT_PUBLIC_SUPABASE_URL,
68+
// secret: process.env.SUPABASE_SERVICE_ROLE_KEY,
69+
// })
8370

8471
export const authOptions: NextAuthOptions = {
85-
adapter: adapters.noop(),
72+
// adapter,
8673
callbacks: {
8774
async session({ session, user }) {
8875
// NOTE: this is needed when using Supabase with RLS. Otherwise this callback can be removed.

0 commit comments

Comments
 (0)