Better AuthBA
Better Auth13mo ago
Ray

issue getting session using mongodb

the login buttons work and i looking at the collection on mongodb it was able to insert the data, but when i try to check for a session on /dashboard using:
auth.api.getSession({
  headers: await headers()
})


i get the following error:
 ERROR   INTERNAL_SERVER_ERROR Invalid id value                                                                                             Better Auth  

  at i (.next\server\chunks\ssr\node_modules_better-auth_dist_b96472._.js:5035:23)
  at .next\server\chunks\ssr\node_modules_better-auth_dist_b96472._.js:5080:34
  at Array.map (<anonymous>)
  at Object.convertWhereClause (.next\server\chunks\ssr\node_modules_better-auth_dist_b96472._.js:5075:23)
  at Object.findOne (.next\server\chunks\ssr\node_modules_better-auth_dist_b96472._.js:5183:66)
  at Object.findSession (.next\server\chunks\ssr\node_modules_better-auth_dist_b96472._.js:3721:29)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async .next\server\chunks\ssr\node_modules_better-auth_dist_b96472._.js:1220:21
  at async handle (.next\server\chunks\ssr\node_modules_0e8043._.js:1767:23)
  at async Ie.a.<computed> [as getSession] (.next\server\chunks\ssr\node_modules_better-auth_dist_b96472._.js:3395:17)
  at async Promise.all (index 0)
  at async Page (.next\server\chunks\ssr\[root of the server]__3677c3._.js:1370:21)

[APIError [BetterCallAPIError]: API Error: INTERNAL_SERVER_ERROR internal server error] {
  status: 'INTERNAL_SERVER_ERROR',
  headers: Headers {},
  body: { message: 'internal server error', code: 'INTERNAL_SERVER_ERROR' },
  [cause]: { message: 'internal server error', code: 'INTERNAL_SERVER_ERROR' }
}
 GET /dashboard 500 in 1127ms
Was this page helpful?