Session: There is an issue with the where clause #283

Closed
opened 2026-03-13 07:40:41 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @xharauenea on GitHub (Nov 26, 2024).

Describe the bug

update "session" set  where "session"."token" = $1 returning "id", "user_id", "token", "expires_at", "ip_address", "user_agent", "created_at", "updated_at" -- params: ["lLEU8HBrqpQA9dA_L034KMgL44bWiOQg"]

 ERROR   NeonDbError syntax error at or near "where"     
at execute (webpack-internal:///(rsc)/../../node_modules/@neondatabase/serverless/index.mjs:1568:77)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async NeonHttpPreparedQuery.execute (webpack-internal:///(rsc)/../../node_modules/drizzle-orm/neon-http/session.js:43:20)
  at async withReturning (webpack-internal:///(rsc)/../../node_modules/better-auth/dist/adapters/drizzle.js:15:9932)
  at async Object.update (webpack-internal:///(rsc)/../../node_modules/better-auth/dist/adapters/drizzle.js:15:11336)
  at async s (webpack-internal:///(rsc)/../../node_modules/better-auth/dist/index.js:128:14150)
  at async Object.updateSession (webpack-internal:///(rsc)/../../node_modules/better-auth/dist/index.js:128:17853)
  at async Object.setActiveOrganization (webpack-internal:///(rsc)/../../node_modules/better-auth/dist/plugins.js:138:28984)
  at async eval (webpack-internal:///(rsc)/../../node_modules/better-auth/dist/plugins.js:138:52718)
  at async handle (webpack-internal:///(rsc)/../../node_modules/better-call/dist/index.js:403:17)
  at async Ue.a.<computed> (webpack-internal:///(rsc)/../../node_modules/better-auth/dist/index.js:128:10227)
  at async handler (webpack-internal:///(rsc)/../../node_modules/better-call/dist/index.js:619:26)
  at async handler (webpack-internal:///(rsc)/../../node_modules/better-call/dist/index.js:670:19)
  at async AppRouteRouteModule.do (/Users/eneaxharau/Documents/Work/inventory-manager/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:10:32976)
  at async AppRouteRouteModule.handle (/Users/eneaxharau/Documents/Work/inventory-manager/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:10:38477)
  at async doRender (/Users/eneaxharau/Documents/Work/inventory-manager/node_modules/next/dist/server/base-server.js:1493:42)
  at async responseGenerator (/Users/eneaxharau/Documents/Work/inventory-manager/node_modules/next/dist/server/base-server.js:1834:28)
  at async DevServer.renderToResponseWithComponentsImpl (/Users/eneaxharau/Documents/Work/inventory-manager/node_modules/next/dist/server/base-server.js:1876:28)
  at async DevServer.renderPageComponent (/Users/eneaxharau/Documents/Work/inventory-manager/node_modules/next/dist/server/base-server.js:2290:24)
  at async DevServer.renderToResponseImpl (/Users/eneaxharau/Documents/Work/inventory-manager/node_modules/next/dist/server/base-server.js:2328:32) 

To Reproduce
Steps to reproduce the behavior:

  1. Using drizzle Adapter and NeonDB
  2. Trying to set an active organization
  3. Session doesn't get updated

Expected behavior
This is supposed to just update the session with the active organization, based on the id i passed on the function

  • OS: MacOS Sequoia
  • Browser: Arc Browser
Originally created by @xharauenea on GitHub (Nov 26, 2024). **Describe the bug** ``` update "session" set where "session"."token" = $1 returning "id", "user_id", "token", "expires_at", "ip_address", "user_agent", "created_at", "updated_at" -- params: ["lLEU8HBrqpQA9dA_L034KMgL44bWiOQg"] ERROR NeonDbError syntax error at or near "where" at execute (webpack-internal:///(rsc)/../../node_modules/@neondatabase/serverless/index.mjs:1568:77) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async NeonHttpPreparedQuery.execute (webpack-internal:///(rsc)/../../node_modules/drizzle-orm/neon-http/session.js:43:20) at async withReturning (webpack-internal:///(rsc)/../../node_modules/better-auth/dist/adapters/drizzle.js:15:9932) at async Object.update (webpack-internal:///(rsc)/../../node_modules/better-auth/dist/adapters/drizzle.js:15:11336) at async s (webpack-internal:///(rsc)/../../node_modules/better-auth/dist/index.js:128:14150) at async Object.updateSession (webpack-internal:///(rsc)/../../node_modules/better-auth/dist/index.js:128:17853) at async Object.setActiveOrganization (webpack-internal:///(rsc)/../../node_modules/better-auth/dist/plugins.js:138:28984) at async eval (webpack-internal:///(rsc)/../../node_modules/better-auth/dist/plugins.js:138:52718) at async handle (webpack-internal:///(rsc)/../../node_modules/better-call/dist/index.js:403:17) at async Ue.a.<computed> (webpack-internal:///(rsc)/../../node_modules/better-auth/dist/index.js:128:10227) at async handler (webpack-internal:///(rsc)/../../node_modules/better-call/dist/index.js:619:26) at async handler (webpack-internal:///(rsc)/../../node_modules/better-call/dist/index.js:670:19) at async AppRouteRouteModule.do (/Users/eneaxharau/Documents/Work/inventory-manager/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:10:32976) at async AppRouteRouteModule.handle (/Users/eneaxharau/Documents/Work/inventory-manager/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:10:38477) at async doRender (/Users/eneaxharau/Documents/Work/inventory-manager/node_modules/next/dist/server/base-server.js:1493:42) at async responseGenerator (/Users/eneaxharau/Documents/Work/inventory-manager/node_modules/next/dist/server/base-server.js:1834:28) at async DevServer.renderToResponseWithComponentsImpl (/Users/eneaxharau/Documents/Work/inventory-manager/node_modules/next/dist/server/base-server.js:1876:28) at async DevServer.renderPageComponent (/Users/eneaxharau/Documents/Work/inventory-manager/node_modules/next/dist/server/base-server.js:2290:24) at async DevServer.renderToResponseImpl (/Users/eneaxharau/Documents/Work/inventory-manager/node_modules/next/dist/server/base-server.js:2328:32) ``` **To Reproduce** Steps to reproduce the behavior: 1. Using drizzle Adapter and NeonDB 2. Trying to set an active organization 3. Session doesn't get updated **Expected behavior** This is supposed to just update the session with the active organization, based on the id i passed on the function - OS: MacOS Sequoia - Browser: Arc Browser
Author
Owner

@xharauenea commented on GitHub (Nov 26, 2024):

Solved this, by adding activeOrganizationId in the Session Table, but nowhere in the docs it said so.

@xharauenea commented on GitHub (Nov 26, 2024): Solved this, by adding activeOrganizationId in the Session Table, but nowhere in the docs it said so.
Author
Owner

@Bekacru commented on GitHub (Nov 26, 2024):

Solved this, by adding activeOrganizationId in the Session Table, but nowhere in the docs it said so.

sorry about that. Just got added!

@Bekacru commented on GitHub (Nov 26, 2024): > Solved this, by adding activeOrganizationId in the Session Table, but nowhere in the docs it said so. sorry about that. Just got added!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#283