Hi, I am new to NextAuth and authentication and seeing this in nodejs "error Detected lowercase method 'options' in 'src\app\api\auth\[...nextauth]\route.js'", is this error expected or it can be handled ?? #7929
Unanswered
IAMAFIVESTARMAN
asked this question in
Help
Replies: 1 comment
-
replace |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
So I am using various providers for authentication and getting this warning/error in server, is it ignorable error ?
I am not able to find any documentation for it as well
error Detected lowercase method 'options' in 'src\app\api\auth[...nextauth]\route.js'. Export the uppercase 'OPTIONS' method name to fix this error.
route.js->
import NextAuth from "next-auth";
import prisma from "../../../../libs/prismadb";
import { PrismaAdapter } from "@auth/prisma-adapter";
import GitHubProvider from "next-auth/providers/github";
import CredentialsProvider from "next-auth/providers/credentials";
import GoogleProvider from "next-auth/providers/google";
export const options = {
adapter: PrismaAdapter(prisma),
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
}),
GitHubProvider({
clientId: process.env.GITHUB_ID,
clientSecret: process.env.GITHUB_SECRET,
}),
CredentialsProvider({
],
secret: process.env.NEXTAUTH_SECRET,
session: {
strategy: "jwt",
},
debug: process.env.NODE_ENV === "development",
pages: {
signIn: "/login",
newUser: "/register",
},
};
const handler = NextAuth(options);
export { handler as GET, handler as POST };
.env file->
NODE_ENV === "development"
DATABASE_URL="mongo string"
GOOGLE_CLIENT_ID="google string"
GOOGLE_CLIENT_SECRET="client secret"
NEXTAUTH_SECRET="secret"
NEXTAUTH_URL=http://localhost:3000/
Beta Was this translation helpful? Give feedback.
All reactions