Hello guys so i ve tried to implement an authentication with mongodb on my app and after installing nextauth v5 (currently in beta) and trying to put any component or page on “client side”, my app would just crash and nothing would work, i ve tried to downgrade the version of next and nextauth and mongodb but still nothing happend, meanwhile i figured out some things:
(i also need to use useState, useEffect ect…)
1.
Here is the link for the code and how it works or just check down below this link
import { signIn } from "@/auth.ts"
export function SignIn() {
return (
<form
action={async () => {
"use server"
await signIn("google")
}}
>
<button type="submit">Signin with Google</button>
</form>
)
}
- app would work like this because the component is generally not on client side only action function uses use server but after trying to add use state or use effect or generally just putting “use client” app would drop the error : Module not found: Can’t resolve ‘child_process’
error image
So on this image you can see this path (./node_modules/mongodb/lib/client-side-encrpytion/mongocrptd_manager.js) that leads to this : const { spawn } = require(‘child_process’);
image of require(‘child_process’)
- i have no idea if i can bypass this somehow it still pops an error after i deleted this require i have no idea if there is any fix for this also you can check my repo link down below this .
here is the link for github repo
i ve tried deleting the require for this ‘child_process’, downgrade all packages, using “client side” that caused the issue and obv didnt work…, also setting webpack childprocess to false didnt work…
Pavle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.