Drizzle Apapter breaks when using the newly released Effect-based execution model (only Promise-based is supported) #2678

Open
opened 2026-03-13 10:12:45 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @rohovskoi on GitHub (Jan 10, 2026).

Steps to reproduce:

  • Install drizzle-orm: "1.0.0-beta.10-42c284e"
  • Create a drizzle db instance:
import * as DrizzleEffectPg from 'drizzle-orm/effect-postgres';
import * as PgClient from '@effect/sql-pg/PgClient';

const client = yield* PgClient.PgClient;
const db = yield* DrizzleEffectPg.drizzle(client, {
          schema,
          casing: 'snake_case',
        });

const auth = betterAuth({
  baseURL: APP.API_URL,
  basePath: '/auth',
  database: drizzleAdapter(translatedDb, {
    provider: 'pg',
    schema: {
      user,
      account,
      verification,
      invitation,
      session
    },
    transaction: false,
  })
})
  • Call auth.api.signInEmail()
  • You will get: ERROR [Better Auth]: User not found { email: 'your-email@some.com' } even though this user exists.

Current VS Expected

Current:
The operation fails because the adapter receives an Effect object instead of a query result array. With a standard Drizzle instance (non Effect bases, this user can be found)

Expected:
There should be some kind of bridge that translates Effects to Promises for now. (As its too much load to support Effect-TS for BA team at the moment I believe)

Here is the DrizzleEffectBridge POC I prepared, for the time being (still needs more testing):
https://gist.github.com/rohovskoi/7bd905eb5e965011708898d6d78cfd6e

Here is an example of how to setup Effect-TS with Drizzle for Effect based execution model:
https://gist.github.com/mikearnaldi/4a27fa89ec197e0b393ec6592ed4ec53

Originally created by @rohovskoi on GitHub (Jan 10, 2026). ## Steps to reproduce: - Install `drizzle-orm: "1.0.0-beta.10-42c284e"` - Create a drizzle db instance: ```ts import * as DrizzleEffectPg from 'drizzle-orm/effect-postgres'; import * as PgClient from '@effect/sql-pg/PgClient'; const client = yield* PgClient.PgClient; const db = yield* DrizzleEffectPg.drizzle(client, { schema, casing: 'snake_case', }); const auth = betterAuth({ baseURL: APP.API_URL, basePath: '/auth', database: drizzleAdapter(translatedDb, { provider: 'pg', schema: { user, account, verification, invitation, session }, transaction: false, }) }) ``` - Call `auth.api.signInEmail()` - You will get: `ERROR [Better Auth]: User not found { email: 'your-email@some.com' }` even though this user exists. ## Current VS Expected **Current:** The operation fails because the adapter receives an Effect object instead of a query result array. With a standard Drizzle instance (non Effect bases, this user can be found) **Expected:** There should be some kind of bridge that translates Effects to Promises for now. (As its too much load to support Effect-TS for BA team at the moment I believe) Here is the DrizzleEffectBridge POC I prepared, for the time being (still needs more testing): https://gist.github.com/rohovskoi/7bd905eb5e965011708898d6d78cfd6e Here is an example of how to setup Effect-TS with Drizzle for Effect based execution model: https://gist.github.com/mikearnaldi/4a27fa89ec197e0b393ec6592ed4ec53
GiteaMirror added the adapter label 2026-03-13 10:12:45 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 10, 2026):

The Drizzle Adapter in Better Auth is tightly coupled to Drizzle's Promise-based execution model—every CRUD and transaction method expects query builders to return Promises and resolve to arrays, objects, or row counts. When using Drizzle's new Effect-based execution model, these methods instead receive Effect objects, which causes failures like the "User not found" error you saw, even when the user exists. There is no built-in handling or conversion of Effect objects to Promises in the adapter, and no official support or roadmap for Effect-based execution in the Drizzle Adapter at this time. Recent and open pull requests focus on schema and relations compatibility, not on bridging Effect to Promise or supporting Effect-TS natively citation citation.

Your DrizzleEffectBridge POC is currently the only viable workaround: it wraps Effect-based query builders and executes them as Promises, making them compatible with Better Auth's adapter expectations. This approach is necessary until (or unless) native Effect-based support is added to the adapter. If you need to use Effect-based Drizzle with Better Auth, using a bridge/wrapper like yours is the recommended path for now. Keep an eye on future updates to the Drizzle Adapter or Better Auth for any changes in this area.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Jan 10, 2026): <!-- Answer --> The Drizzle Adapter in Better Auth is tightly coupled to Drizzle's Promise-based execution model—every CRUD and transaction method expects query builders to return Promises and resolve to arrays, objects, or row counts. When using Drizzle's new Effect-based execution model, these methods instead receive Effect objects, which causes failures like the "User not found" error you saw, even when the user exists. There is no built-in handling or conversion of Effect objects to Promises in the adapter, and no official support or roadmap for Effect-based execution in the Drizzle Adapter at this time. Recent and open pull requests focus on schema and relations compatibility, not on bridging Effect to Promise or supporting Effect-TS natively [citation](https://github.com/better-auth/better-auth/pull/6913) [citation](https://github.com/better-auth/better-auth/blob/c31c92f3d24f3ccfb6776d4634e0681c6dee2db5/packages/better-auth/src/adapters/drizzle-adapter/drizzle-adapter.ts#L73-L606). Your DrizzleEffectBridge POC is currently the only viable workaround: it wraps Effect-based query builders and executes them as Promises, making them compatible with Better Auth's adapter expectations. This approach is necessary until (or unless) native Effect-based support is added to the adapter. If you need to use Effect-based Drizzle with Better Auth, using a bridge/wrapper like yours is the recommended path for now. Keep an eye on future updates to the Drizzle Adapter or Better Auth for any changes in this area. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/53614508-442a-4945-8629-d91d3f69d9e2?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/53614508-442a-4945-8629-d91d3f69d9e2?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/53614508-442a-4945-8629-d91d3f69d9e2?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/53614508-442a-4945-8629-d91d3f69d9e2?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/53614508-442a-4945-8629-d91d3f69d9e2?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/53614508-442a-4945-8629-d91d3f69d9e2?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/53614508-442a-4945-8629-d91d3f69d9e2?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20Drizzle%20Adapter%20in%20Better%20Auth%20is%20tightly%20coupled%20to%20Drizzle%27s%20Promise-based%20execution%20model%E2%80%94every%20CRUD%20and%20transaction%20method%20expects%20query%20builders%20to%20return%20Promises%20and%20resolve%20to%20arrays%2C%20objects%2C%20or%20row%20counts.%20When%20using%20Drizzle%27s%20new%20Effect-based%20execution%20model%2C%20these%20methods%20instead%20receive%20Effect%20objects%2C%20which%20causes%20failures%20like%20the%20%22User%20not%20found%22%20error%20you%20saw%2C%20even%20when%20the%20user%20exists.%20There%20is%20no%20built-in%20handling%20or%20conversion%20of%20Effect%20objects%20to%20Promises%20in%20the%20adapter%2C%20and%20no%20official%20support%20or%20roadmap%20for%20Effect-based%20execution%20in%20the%20Drizzle%20Adapter%20at%20this%20time.%20Recent%20and%20open%20pull%20requests%20focus%20on%20schema%20and%20relations%20compatibility%2C%20not%20on%20bridging%20Effect%20to%20Promise%20or%20supporting%20Effect-TS%20natively%C2%A0%5Bcitation%5D%28https%3A//github.com/better-auth/better-auth/pull/6913%29%C2%A0%5Bcitation%5D%28https%3A//github.com/better-auth/better-auth/blob/c31c92f3d24f3ccfb6776d4634e0681c6dee2db5/packages/better-auth/src/adapters/drizzle-adapter/drizzle-adapter.ts%23L73-L606%29.%0A%0AYour%20DrizzleEffectBridge%20POC%20is%20currently%20the%20only%20viable%20workaround%3A%20it%20wraps%20Effect-based%20query%20builders%20and%20executes%20them%20as%20Promises%2C%20making%20them%20compatible%20with%20Better%20Auth%27s%20adapter%20expectations.%20This%20approach%20is%20necessary%20until%20%28or%20unless%29%20native%20Effect-based%20support%20is%20added%20to%20the%20adapter.%20If%20you%20need%20to%20use%20Effect-based%20Drizzle%20with%20Better%20Auth%2C%20using%20a%20bridge/wrapper%20like%20yours%20is%20the%20recommended%20path%20for%20now.%20Keep%20an%20eye%20on%20future%20updates%20to%20the%20Drizzle%20Adapter%20or%20Better%20Auth%20for%20any%20changes%20in%20this%20area.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/7234)
Author
Owner

@bytaesu commented on GitHub (Jan 11, 2026):

I'm checking this!

@bytaesu commented on GitHub (Jan 11, 2026): I'm checking this!
Author
Owner

@bytaesu commented on GitHub (Jan 11, 2026):

https://effect.website/docs/additional-resources/effect-vs-promise

Hi @rohovskoi,

Because Promise and Effect handle async operations differently, I think this requires careful review for safe support. We’re also working on support for Drizzle Relational Queries v2 🙂

@ping-maxwell could we explore supporting Effect, or clearly document this as a limitation for now?

@bytaesu commented on GitHub (Jan 11, 2026): > https://effect.website/docs/additional-resources/effect-vs-promise Hi @rohovskoi, Because `Promise` and `Effect` handle async operations differently, I think this requires careful review for safe support. We’re also working on support for Drizzle Relational Queries v2 🙂 @ping-maxwell could we explore supporting Effect, or clearly document this as a limitation for now?
Author
Owner

@ping-maxwell commented on GitHub (Jan 12, 2026):

Yeah for now it's a limitation, it won't work. Depending on how implementation would look it would either be directly implemented into the current drizzle adapter, otherwise it will have its own separate package.

@ping-maxwell commented on GitHub (Jan 12, 2026): Yeah for now it's a limitation, it won't work. Depending on how implementation would look it would either be directly implemented into the current drizzle adapter, otherwise it will have its own separate package.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#2678