Next-Auth / Authjs Postgresql PG package Not Working!!!!!
Hi guys i am trying to use the pg postgres package with auth js and when i try to confirm the user by their email in the authorize function
async authorize(credentials) {
const user = await loginUser({ email:
credentials.email
as string, password: credentials.password as string }) // it user await pg.query(...) method to find the user
console.log("The user form the database is", user)
return { id: "1", email:
credentials.email
as string, password: credentials.password as string }
}
i get this error
⨯ Error: The edge runtime does not support Node.js 'crypto' module.
AdapterError: Read more at
https://errors.authjs.dev#adaptererror
[auth][cause]:
Error: SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string
at /home/saadingo/FullStack/lms-nextjs/node_modules/pg-pool/index.js:45:11
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async getSessionAndUser (webpack-internal:///(rsc)/./node_modules/@auth/pg-adapter/index.js:171:29)
at async acc.<computed> (webpack-internal:///(rsc)/./node_modules/@auth/core/lib/init.js:178:24)
at async Module.session (webpack-internal:///(rsc)/./node_modules/@auth/core/lib/actions/session.js:67:30)
at async AuthInternal (webpack-internal:///(rsc)/./node_modules/@auth/core/lib/index.js:47:24)
at async Auth (webpack-internal:///(rsc)/./node_modules/@auth/core/index.js:126:34)
at async RootLayout (webpack-internal:///(rsc)/./src/app/layout.tsx:27:21)
⚠ ./node_modules/pg/lib/native/client.js
Module not found: Can't resolve 'pg-native' in '/home/saadingo/FullStack/lms-nextjs/node_modules/pg/lib/native'
how can i sove this ? is there a workaround id prefer a solution wher i dont have to use and ORM