Getting drizzle working with next-auth

Has anyone gotten drizzle working with next-auth?
Here's the implementation that I've been using: https://github.com/c-karaolis/drizzle-next-auth-adapter-postgres/blob/main/src/lib/drizzle-next-auth-postgres-adapter.ts

From what I can see I have all of my callback urls set up correctly, all environment vars that I need, and nothing else that is barring it from working that I can remember from previous times of setting it up.

Maybe I'm missing something obvious here, but I'm really lost as to what is going on.

I keep running into this error:
[next-auth][error][adapter_error_getUserByAccount]
https://next-auth.js.org/errors#adapter_error_getuserbyaccount Cannot read properties of undefined (reading 'users') {
  message: "Cannot read properties of undefined (reading 'users')",
  stack: "TypeError: Cannot read properties of undefined (reading 'users')\n" +
    '    at getUserByAccount (webpack-internal:///(sc_server)/./src/lib/drizzle-next-auth-postgres-adapter.ts:48:30)\n' +
    '    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)',
  name: 'TypeError'
}
[next-auth][error][OAUTH_CALLBACK_HANDLER_ERROR]
https://next-auth.js.org/errors#oauth_callback_handler_error Cannot read properties of undefined (reading 'users') TypeError: Cannot read properties of undefined (reading 'users')
    at getUserByAccount (webpack-internal:///(sc_server)/./src/lib/drizzle-next-auth-postgres-adapter.ts:48:30)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  name: 'GetUserByAccountError',
  code: undefined
}

-  ┌ GET /api/auth/callback/github?code=50c5bc4bdc41e92f635b&state=pyudVQcppttAMcVmtAaOT15_0Afb8bR8C_1lnsVpPgQ 302 in 497ms

   └──── GET https://api.github.com/user/emails 403 in 135ms (cache: MISS)
GitHub
A custom drizzle orm adapter for NextAuth.js. Contribute to c-karaolis/drizzle-next-auth-adapter-postgres development by creating an account on GitHub.
drizzle-next-auth-adapter-postgres/src/lib/drizzle-next-auth-postgr...
Was this page helpful?