auth.js middleware
Answered
Pyramid ant posted this in #help-forum

Pyramid antOP
Hello, when i created a middleware i got this error:
How can i fix it.. I looked at the web nothing was there
[auth][error] MissingAdapter: Email login requires an adapter. Read more at https://errors.authjs.dev#missingadapter
at assertConfig (C:\Users\wvn_0\Desktop\project\my-app\.next\server\edge\chunks\node_modules_@auth_core_d0be13._.js:657:34)
at Auth (C:\Users\wvn_0\Desktop\project\my-app\.next\server\edge\chunks\node_modules_@auth_core_d0be13._.js:5193:202)
How can i fix it.. I looked at the web nothing was there
Answered by Pyramid ant
but i fixed it somehow... i used this:
auth.ts:
auth.config.ts:
auth.ts:
import NextAuth from "next-auth"
import authConfig from "../../auth.config"
export const { handlers, signIn, signOut, auth } = NextAuth({
...authConfig
})
auth.config.ts:
import Resend from "next-auth/providers/resend"
import { PrismaAdapter } from "@auth/prisma-adapter"
import { prisma } from "./src/utils/db" // Adjust path if needed
import type { NextAuthConfig } from "next-auth"
export default {
adapter: PrismaAdapter(prisma),
session: { strategy: "jwt" },
providers: [
Resend({
from: "no-reply@domain.com",
}),
],
secret: process.env.AUTH_SECRET, // Ensure this is set in your .env file
pages: {
signIn: "/signin",
signOut: "/signout",
newUser: "/",
},
} satisfies NextAuthConfig;
19 Replies
it says it in the error
lemme send you the adapter page

Pyramid antOP
I have adapter

show

Pyramid antOP
But it dont detect

Pyramid antOP
but i fixed it somehow... i used this:
auth.ts:
auth.config.ts:
auth.ts:
import NextAuth from "next-auth"
import authConfig from "../../auth.config"
export const { handlers, signIn, signOut, auth } = NextAuth({
...authConfig
})
auth.config.ts:
import Resend from "next-auth/providers/resend"
import { PrismaAdapter } from "@auth/prisma-adapter"
import { prisma } from "./src/utils/db" // Adjust path if needed
import type { NextAuthConfig } from "next-auth"
export default {
adapter: PrismaAdapter(prisma),
session: { strategy: "jwt" },
providers: [
Resend({
from: "no-reply@domain.com",
}),
],
secret: process.env.AUTH_SECRET, // Ensure this is set in your .env file
pages: {
signIn: "/signin",
signOut: "/signout",
newUser: "/",
},
} satisfies NextAuthConfig;
Answer

are you sure it connects to prisma?

@Diamond Master are you sure it connects to prisma?

Pyramid antOP
Its fixed alredy
what was the error?

Pyramid antOP
I dont know. I rewrited it alredy