#Error: Invariant: missing action ID.
41 messages · Page 1 of 1 (latest)
Hello, did you fix it ?
I encountered same issue
I found a workaround, 1 sec
it is the way you redirect, you have to do it the old way
mhh
const result = await signIn("credentials", {
username: userName.current,
password: pass.current,
redirect: false,
callbackUrl: "/",
});```
i'm not even redirecting
oh
how the hell are you getting this error?
are you trying to access what endpoint?
nextauth
import NextAuth, { NextAuthOptions } from 'next-auth';
import { MongoDBAdapter } from '@next-auth/mongodb-adapter';
import clientPromise from '../../../lib/mongodb';
import CredentialsProvider from 'next-auth/providers/credentials';
import { compare } from 'bcrypt';
import dbConnect from '../../../lib/dbConnect';
import User from '../../../model/User';
export const authOptions: NextAuthOptions = {
adapter: MongoDBAdapter(clientPromise),
providers: [
CredentialsProvider({
id: 'credentials',
name: 'Credentials',
credentials: {
email: {
label: 'Email',
type: 'text'
},
password: {
label: 'Password',
type: 'password'
}
},
async authorize(credentials) {
await dbConnect();
// Find user with the email
const user = await User.findOne({
email: credentials?.email
});
// Email Not found
if (!user) {
console.log("test");
}
// Check hased password with DB hashed password
const isPasswordCorrect = await compare(
credentials!.password,
user.hashedPassword
);
// Incorrect password
if (!isPasswordCorrect) {
console.log("test");
}
return user;
}
})
],
pages: {
signIn: '/auth'
},
debug: process.env.NODE_ENV == 'development',
session: {
strategy: 'jwt'
},
jwt: {
secret: process.env.NEXTAUTH_JWT_SECRET
},
secret: process.env.NEXTAUTH_SECRET
};
export default NextAuth(authOptions);
I'm using the default implementation so I cant help you with that
No
Use t3-stack
I can help you with that if you need
Do you have a specific reason for using JWT?
t3 does not use jwt, it has the db sync already made
and there is no problem for accessing anything
okay i'll work around this solution
Okay, sorry for not helping you with that, our errors are not the same :C
i'll check for t3
You will have no issue at all with the out-of-the-box implementation for NextAuth
I used nextauth because it's easier solution for just some log
Okay, I have to check how implement it, and how I can use it with mongoose etc
WARN: t3 stack implementation for NextAuth is based at platform logins (Ex: Google, Discord, Github, etc.), It will not work with Credentials (Email/Password)
oh
Just migrate to prisma, I used mongoose before and prisma is so much better
So I have to recreate my entire app x)
Imo you will have much more headache using mongoose than writing a prisma schema in 3 minutes
(I used mongoose for 2 years in a row)
I'll switch now
But I have to make credentials working