Error: No transactions support in neon-http driver - unable_to_create_user #1962

Closed
opened 2026-03-13 09:16:52 -05:00 by GiteaMirror · 11 comments
Owner

Originally created by @TheOrcDev on GitHub (Sep 18, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Create a project with Next.js, Drizzle and Neon.

drizzle.ts should look like this:

import { neon } from "@neondatabase/serverless";
import { drizzle } from "drizzle-orm/neon-http";

import * as schema from "./schema";

const sql = neon(process.env.DATABASE_URL!);
const db = drizzle(sql, { schema });

export default db;

This dependency is making the problem drizzle-orm/neon-http

Current vs. Expected behavior

Just try to signup using Google provider and the error will be like this:

2025-09-18T11:23:56.744Z ERROR [Better Auth]: Error: No transactions support in neon-http driver
2025-09-18T11:23:56.745Z ERROR [Better Auth]: unable_to_create_user

What version of Better Auth are you using?

1.3.11

System info

{
  "system": {
    "platform": "darwin",
    "arch": "arm64",
    "version": "Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:40 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T8132",
    "release": "24.6.0",
    "cpuCount": 10,
    "cpuModel": "Apple M4",
    "totalMemory": "32.00 GB",
    "freeMemory": "0.94 GB"
  },
  "node": {
    "version": "v24.6.0",
    "env": "development"
  },
  "packageManager": {
    "name": "npm",
    "version": "11.5.1"
  },
  "frameworks": [
    {
      "name": "next",
      "version": "15.5.3"
    },
    {
      "name": "react",
      "version": "^19.1.1"
    }
  ],
  "databases": [
    {
      "name": "drizzle",
      "version": "^0.44.5"
    },
    {
      "name": "@neondatabase/serverless",
      "version": "^1.0.1"
    }
  ],
  "betterAuth": {
    "version": "^1.3.11",
    "config": {
      "emailVerification": {
        "sendOnSignUp": true
      },
      "socialProviders": {
        "google": {
          "clientId": "[REDACTED]",
          "clientSecret": "[REDACTED]"
        }
      },
      "emailAndPassword": {
        "enabled": true,
        "requireEmailVerification": true
      },
      "databaseHooks": {
        "session": {
          "create": {}
        }
      },
      "plugins": [
        {
          "name": "organization",
          "config": {
            "id": "organization",
            "endpoints": {},
            "schema": {
              "organization": {
                "fields": {
                  "name": {
                    "type": "string",
                    "required": true,
                    "sortable": true
                  },
                  "slug": {
                    "type": "string",
                    "unique": true,
                    "sortable": true
                  },
                  "logo": {
                    "type": "string",
                    "required": false
                  },
                  "createdAt": {
                    "type": "date",
                    "required": true
                  },
                  "metadata": {
                    "type": "string",
                    "required": false
                  }
                }
              },
              "member": {
                "fields": {
                  "organizationId": {
                    "type": "string",
                    "required": true,
                    "references": {
                      "model": "organization",
                      "field": "id"
                    }
                  },
                  "userId": {
                    "type": "string",
                    "required": true,
                    "references": {
                      "model": "user",
                      "field": "id"
                    }
                  },
                  "role": {
                    "type": "string",
                    "required": true,
                    "sortable": true,
                    "defaultValue": "member"
                  },
                  "createdAt": {
                    "type": "date",
                    "required": true
                  }
                }
              },
              "invitation": {
                "fields": {
                  "organizationId": {
                    "type": "string",
                    "required": true,
                    "references": {
                      "model": "organization",
                      "field": "id"
                    }
                  },
                  "email": {
                    "type": "string",
                    "required": true,
                    "sortable": true
                  },
                  "role": {
                    "type": "string",
                    "required": false,
                    "sortable": true
                  },
                  "status": {
                    "type": "string",
                    "required": true,
                    "sortable": true,
                    "defaultValue": "pending"
                  },
                  "expiresAt": {
                    "type": "date",
                    "required": true
                  },
                  "inviterId": {
                    "type": "string",
                    "references": {
                      "model": "user",
                      "field": "id"
                    },
                    "required": true
                  }
                }
              },
              "session": {
                "fields": {
                  "activeOrganizationId": {
                    "type": "string",
                    "required": false
                  }
                }
              }
            },
            "$Infer": {
              "Organization": {},
              "Invitation": {},
              "Member": {},
              "Team": {},
              "TeamMember": {},
              "ActiveOrganization": {}
            },
            "$ERROR_CODES": {
              "YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION": "You are not allowed to create a new organization",
              "YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS": "You have reached the maximum number of organizations",
              "ORGANIZATION_ALREADY_EXISTS": "Organization already exists",
              "ORGANIZATION_NOT_FOUND": "Organization not found",
              "USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION": "User is not a member of the organization",
              "YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION": "You are not allowed to update this organization",
              "YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION": "You are not allowed to delete this organization",
              "NO_ACTIVE_ORGANIZATION": "No active organization",
              "USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION": "User is already a member of this organization",
              "MEMBER_NOT_FOUND": "Member not found",
              "ROLE_NOT_FOUND": "Role not found",
              "YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM": "You are not allowed to create a new team",
              "TEAM_ALREADY_EXISTS": "Team already exists",
              "TEAM_NOT_FOUND": "Team not found",
              "YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER": "You cannot leave the organization as the only owner",
              "YOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER": "You cannot leave the organization without an owner",
              "YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER": "You are not allowed to delete this member",
              "YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION": "You are not allowed to invite users to this organization",
              "USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION": "User is already invited to this organization",
              "INVITATION_NOT_FOUND": "Invitation not found",
              "YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION": "You are not the recipient of the invitation",
              "EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION": "Email verification required before accepting or rejecting invitation",
              "YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION": "You are not allowed to cancel this invitation",
              "INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION": "Inviter is no longer a member of the organization",
              "YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE": "You are not allowed to invite a user with this role",
              "FAILED_TO_RETRIEVE_INVITATION": "Failed to retrieve invitation",
              "YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS": "You have reached the maximum number of teams",
              "UNABLE_TO_REMOVE_LAST_TEAM": "Unable to remove last team",
              "YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER": "You are not allowed to update this member",
              "ORGANIZATION_MEMBERSHIP_LIMIT_REACHED": "Organization membership limit reached",
              "YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION": "You are not allowed to create teams in this organization",
              "YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION": "You are not allowed to delete teams in this organization",
              "YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM": "You are not allowed to update this team",
              "YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM": "You are not allowed to delete this team",
              "INVITATION_LIMIT_REACHED": "Invitation limit reached",
              "TEAM_MEMBER_LIMIT_REACHED": "Team member limit reached",
              "USER_IS_NOT_A_MEMBER_OF_THE_TEAM": "User is not a member of the team",
              "YOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM": "You are not allowed to list the members of this team",
              "YOU_DO_NOT_HAVE_AN_ACTIVE_TEAM": "You do not have an active team",
              "YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER": "You are not allowed to create a new member",
              "YOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER": "You are not allowed to remove a team member",
              "YOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION": "You are not allowed to access this organization as an owner",
              "YOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION": "You are not a member of this organization",
              "MISSING_AC_INSTANCE": "Dynamic Access Control requires a pre-defined ac instance on the server auth plugin. Read server logs for more information",
              "YOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE": "You must be in an organization to create a role",
              "YOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE": "You are not allowed to create a role",
              "YOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE": "You are not allowed to update a role",
              "YOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE": "You are not allowed to delete a role",
              "YOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE": "You are not allowed to read a role",
              "YOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE": "You are not allowed to list a role",
              "YOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE": "You are not allowed to get a role",
              "TOO_MANY_ROLES": "This organization has too many roles",
              "INVALID_RESOURCE": "The provided permission includes an invalid resource",
              "ROLE_NAME_IS_ALREADY_TAKEN": "That role name is already taken",
              "CANNOT_DELETE_A_PRE_DEFINED_ROLE": "Cannot delete a pre-defined role"
            },
            "options": {
              "roles": {
                "owner": {
                  "statements": {
                    "project": [
                      "create",
                      "update",
                      "delete"
                    ],
                    "organization": [
                      "update",
                      "delete"
                    ]
                  }
                },
                "admin": {
                  "statements": {
                    "project": [
                      "create",
                      "update"
                    ]
                  }
                },
                "member": {
                  "statements": {
                    "project": [
                      "create"
                    ]
                  }
                }
              }
            }
          }
        },
        {
          "name": "last-login-method",
          "config": {
            "id": "last-login-method",
            "hooks": {
              "after": [
                {}
              ]
            }
          }
        },
        {
          "name": "next-cookies",
          "config": {
            "id": "next-cookies",
            "hooks": {
              "after": [
                {}
              ]
            }
          }
        }
      ]
    }
  }
}

Which area(s) are affected? (Select all that apply)

Backend

Auth config (if applicable)

import { db } from "@/db/drizzle";
import { schema } from "@/db/schema";

import OrganizationInvitationEmail from "@/components/emails/organization-invitation";
import ForgotPasswordEmail from "@/components/emails/reset-password";
import VerifyEmail from "@/components/emails/verify-email";
import { getActiveOrganization } from "@/server/organizations";
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { nextCookies } from "better-auth/next-js";
import { lastLoginMethod, organization } from "better-auth/plugins";
import { Resend } from "resend";
import { admin, member, owner } from "./auth/permissions";

const resend = new Resend(process.env.RESEND_API_KEY as string);

export const auth = betterAuth({
    emailVerification: {
        sendVerificationEmail: async ({ user, url }) => {
            resend.emails.send({
                from: `${process.env.EMAIL_SENDER_NAME} <${process.env.EMAIL_SENDER_ADDRESS}>`,
                to: user.email,
                subject: "Verify your email",
                react: VerifyEmail({ username: user.name, verifyUrl: url }),
            });
        },
        sendOnSignUp: true,
    },
    socialProviders: {
        google: {
            clientId: process.env.GOOGLE_CLIENT_ID as string,
            clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
        },
    },
    emailAndPassword: {
        enabled: true,
        sendResetPassword: async ({ user, url }) => {
            resend.emails.send({
                from: `${process.env.EMAIL_SENDER_NAME} <${process.env.EMAIL_SENDER_ADDRESS}>`,
                to: user.email,
                subject: "Reset your password",
                react: ForgotPasswordEmail({ username: user.name, resetUrl: url, userEmail: user.email }),
            });
        },
        requireEmailVerification: true
    },
    databaseHooks: {
        session: {
            create: {
                before: async (session) => {
                    const organization = await getActiveOrganization(session.userId)
                    return {
                        data: {
                            ...session,
                            activeOrganizationId: organization?.id
                        }
                    }
                }
            }
        }
    },
    database: drizzleAdapter(db, {
        provider: "pg",
        schema,
    }),
    plugins: [organization({
        async sendInvitationEmail(data) {
            const inviteLink = `${process.env.NEXT_PUBLIC_APP_URL}/api/accept-invitation/${data.id}`

            resend.emails.send({
                from: `${process.env.EMAIL_SENDER_NAME} <${process.env.EMAIL_SENDER_ADDRESS}>`,
                to: data.email,
                subject: "You've been invited to join our organization",
                react: OrganizationInvitationEmail({
                    email: data.email,
                    invitedByUsername: data.inviter.user.name,
                    invitedByEmail: data.inviter.user.email,
                    teamName: data.organization.name,
                    inviteLink
                })
            })
        },
        roles: {
            owner,
            admin,
            member
        }
    }), lastLoginMethod(), nextCookies()]
});

Additional context

This is happening on all my Better Auth projects, here are two:

https://github.com/TheOrcDev/better-auth-starter
https://github.com/TheOrcDev/textualgames

Originally created by @TheOrcDev on GitHub (Sep 18, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce Create a project with Next.js, Drizzle and Neon. `drizzle.ts` should look like this: ``` import { neon } from "@neondatabase/serverless"; import { drizzle } from "drizzle-orm/neon-http"; import * as schema from "./schema"; const sql = neon(process.env.DATABASE_URL!); const db = drizzle(sql, { schema }); export default db; ``` This dependency is making the problem `drizzle-orm/neon-http` ### Current vs. Expected behavior Just try to signup using Google provider and the error will be like this: ``` 2025-09-18T11:23:56.744Z ERROR [Better Auth]: Error: No transactions support in neon-http driver 2025-09-18T11:23:56.745Z ERROR [Better Auth]: unable_to_create_user ``` ### What version of Better Auth are you using? 1.3.11 ### System info ```bash { "system": { "platform": "darwin", "arch": "arm64", "version": "Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:40 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T8132", "release": "24.6.0", "cpuCount": 10, "cpuModel": "Apple M4", "totalMemory": "32.00 GB", "freeMemory": "0.94 GB" }, "node": { "version": "v24.6.0", "env": "development" }, "packageManager": { "name": "npm", "version": "11.5.1" }, "frameworks": [ { "name": "next", "version": "15.5.3" }, { "name": "react", "version": "^19.1.1" } ], "databases": [ { "name": "drizzle", "version": "^0.44.5" }, { "name": "@neondatabase/serverless", "version": "^1.0.1" } ], "betterAuth": { "version": "^1.3.11", "config": { "emailVerification": { "sendOnSignUp": true }, "socialProviders": { "google": { "clientId": "[REDACTED]", "clientSecret": "[REDACTED]" } }, "emailAndPassword": { "enabled": true, "requireEmailVerification": true }, "databaseHooks": { "session": { "create": {} } }, "plugins": [ { "name": "organization", "config": { "id": "organization", "endpoints": {}, "schema": { "organization": { "fields": { "name": { "type": "string", "required": true, "sortable": true }, "slug": { "type": "string", "unique": true, "sortable": true }, "logo": { "type": "string", "required": false }, "createdAt": { "type": "date", "required": true }, "metadata": { "type": "string", "required": false } } }, "member": { "fields": { "organizationId": { "type": "string", "required": true, "references": { "model": "organization", "field": "id" } }, "userId": { "type": "string", "required": true, "references": { "model": "user", "field": "id" } }, "role": { "type": "string", "required": true, "sortable": true, "defaultValue": "member" }, "createdAt": { "type": "date", "required": true } } }, "invitation": { "fields": { "organizationId": { "type": "string", "required": true, "references": { "model": "organization", "field": "id" } }, "email": { "type": "string", "required": true, "sortable": true }, "role": { "type": "string", "required": false, "sortable": true }, "status": { "type": "string", "required": true, "sortable": true, "defaultValue": "pending" }, "expiresAt": { "type": "date", "required": true }, "inviterId": { "type": "string", "references": { "model": "user", "field": "id" }, "required": true } } }, "session": { "fields": { "activeOrganizationId": { "type": "string", "required": false } } } }, "$Infer": { "Organization": {}, "Invitation": {}, "Member": {}, "Team": {}, "TeamMember": {}, "ActiveOrganization": {} }, "$ERROR_CODES": { "YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION": "You are not allowed to create a new organization", "YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS": "You have reached the maximum number of organizations", "ORGANIZATION_ALREADY_EXISTS": "Organization already exists", "ORGANIZATION_NOT_FOUND": "Organization not found", "USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION": "User is not a member of the organization", "YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION": "You are not allowed to update this organization", "YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION": "You are not allowed to delete this organization", "NO_ACTIVE_ORGANIZATION": "No active organization", "USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION": "User is already a member of this organization", "MEMBER_NOT_FOUND": "Member not found", "ROLE_NOT_FOUND": "Role not found", "YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM": "You are not allowed to create a new team", "TEAM_ALREADY_EXISTS": "Team already exists", "TEAM_NOT_FOUND": "Team not found", "YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER": "You cannot leave the organization as the only owner", "YOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER": "You cannot leave the organization without an owner", "YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER": "You are not allowed to delete this member", "YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION": "You are not allowed to invite users to this organization", "USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION": "User is already invited to this organization", "INVITATION_NOT_FOUND": "Invitation not found", "YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION": "You are not the recipient of the invitation", "EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION": "Email verification required before accepting or rejecting invitation", "YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION": "You are not allowed to cancel this invitation", "INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION": "Inviter is no longer a member of the organization", "YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE": "You are not allowed to invite a user with this role", "FAILED_TO_RETRIEVE_INVITATION": "Failed to retrieve invitation", "YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS": "You have reached the maximum number of teams", "UNABLE_TO_REMOVE_LAST_TEAM": "Unable to remove last team", "YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER": "You are not allowed to update this member", "ORGANIZATION_MEMBERSHIP_LIMIT_REACHED": "Organization membership limit reached", "YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION": "You are not allowed to create teams in this organization", "YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION": "You are not allowed to delete teams in this organization", "YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM": "You are not allowed to update this team", "YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM": "You are not allowed to delete this team", "INVITATION_LIMIT_REACHED": "Invitation limit reached", "TEAM_MEMBER_LIMIT_REACHED": "Team member limit reached", "USER_IS_NOT_A_MEMBER_OF_THE_TEAM": "User is not a member of the team", "YOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM": "You are not allowed to list the members of this team", "YOU_DO_NOT_HAVE_AN_ACTIVE_TEAM": "You do not have an active team", "YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER": "You are not allowed to create a new member", "YOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER": "You are not allowed to remove a team member", "YOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION": "You are not allowed to access this organization as an owner", "YOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION": "You are not a member of this organization", "MISSING_AC_INSTANCE": "Dynamic Access Control requires a pre-defined ac instance on the server auth plugin. Read server logs for more information", "YOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE": "You must be in an organization to create a role", "YOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE": "You are not allowed to create a role", "YOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE": "You are not allowed to update a role", "YOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE": "You are not allowed to delete a role", "YOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE": "You are not allowed to read a role", "YOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE": "You are not allowed to list a role", "YOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE": "You are not allowed to get a role", "TOO_MANY_ROLES": "This organization has too many roles", "INVALID_RESOURCE": "The provided permission includes an invalid resource", "ROLE_NAME_IS_ALREADY_TAKEN": "That role name is already taken", "CANNOT_DELETE_A_PRE_DEFINED_ROLE": "Cannot delete a pre-defined role" }, "options": { "roles": { "owner": { "statements": { "project": [ "create", "update", "delete" ], "organization": [ "update", "delete" ] } }, "admin": { "statements": { "project": [ "create", "update" ] } }, "member": { "statements": { "project": [ "create" ] } } } } } }, { "name": "last-login-method", "config": { "id": "last-login-method", "hooks": { "after": [ {} ] } } }, { "name": "next-cookies", "config": { "id": "next-cookies", "hooks": { "after": [ {} ] } } } ] } } } ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript import { db } from "@/db/drizzle"; import { schema } from "@/db/schema"; import OrganizationInvitationEmail from "@/components/emails/organization-invitation"; import ForgotPasswordEmail from "@/components/emails/reset-password"; import VerifyEmail from "@/components/emails/verify-email"; import { getActiveOrganization } from "@/server/organizations"; import { betterAuth } from "better-auth"; import { drizzleAdapter } from "better-auth/adapters/drizzle"; import { nextCookies } from "better-auth/next-js"; import { lastLoginMethod, organization } from "better-auth/plugins"; import { Resend } from "resend"; import { admin, member, owner } from "./auth/permissions"; const resend = new Resend(process.env.RESEND_API_KEY as string); export const auth = betterAuth({ emailVerification: { sendVerificationEmail: async ({ user, url }) => { resend.emails.send({ from: `${process.env.EMAIL_SENDER_NAME} <${process.env.EMAIL_SENDER_ADDRESS}>`, to: user.email, subject: "Verify your email", react: VerifyEmail({ username: user.name, verifyUrl: url }), }); }, sendOnSignUp: true, }, socialProviders: { google: { clientId: process.env.GOOGLE_CLIENT_ID as string, clientSecret: process.env.GOOGLE_CLIENT_SECRET as string, }, }, emailAndPassword: { enabled: true, sendResetPassword: async ({ user, url }) => { resend.emails.send({ from: `${process.env.EMAIL_SENDER_NAME} <${process.env.EMAIL_SENDER_ADDRESS}>`, to: user.email, subject: "Reset your password", react: ForgotPasswordEmail({ username: user.name, resetUrl: url, userEmail: user.email }), }); }, requireEmailVerification: true }, databaseHooks: { session: { create: { before: async (session) => { const organization = await getActiveOrganization(session.userId) return { data: { ...session, activeOrganizationId: organization?.id } } } } } }, database: drizzleAdapter(db, { provider: "pg", schema, }), plugins: [organization({ async sendInvitationEmail(data) { const inviteLink = `${process.env.NEXT_PUBLIC_APP_URL}/api/accept-invitation/${data.id}` resend.emails.send({ from: `${process.env.EMAIL_SENDER_NAME} <${process.env.EMAIL_SENDER_ADDRESS}>`, to: data.email, subject: "You've been invited to join our organization", react: OrganizationInvitationEmail({ email: data.email, invitedByUsername: data.inviter.user.name, invitedByEmail: data.inviter.user.email, teamName: data.organization.name, inviteLink }) }) }, roles: { owner, admin, member } }), lastLoginMethod(), nextCookies()] }); ``` ### Additional context This is happening on all my Better Auth projects, here are two: https://github.com/TheOrcDev/better-auth-starter https://github.com/TheOrcDev/textualgames
GiteaMirror added the nextjsbug labels 2026-03-13 09:16:52 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 18, 2025):

Hi @TheOrcDev! I'm Dosu and I’m helping the better-auth team.

This error happens because Better Auth now expects database transaction support for user creation and social login flows, but the neon-http driver (drizzle-orm/neon-http with @neondatabase/serverless) does not support transactions. When Better Auth tries to run user/account/session creation inside a transaction, it fails and surfaces the error "No transactions support in neon-http driver - unable_to_create_user".

There’s no built-in workaround for transactionless drivers in Better Auth. Disabling transactions globally (by setting transaction: false in your adapter config) is possible for some adapters, but it’s risky and not recommended unless you’re only targeting databases that lack transaction support, since it compromises data integrity and atomicity for multi-step operations like signup and social login (docs).

Recommended solution:
Switch to a Postgres driver for Drizzle ORM that supports transactions, such as drizzle-orm/node-postgres or drizzle-orm/postgres-js. These drivers work with Better Auth’s transaction requirements and will avoid this error.

If you need serverless compatibility and must use Neon, you’ll need to track upstream changes for transaction support in the neon-http driver, or consider using Neon’s pooled connection driver (which supports transactions) if your deployment allows it.

If you have after-hooks or plugins that depend on immediate database visibility of the user, be aware that Better Auth commits the transaction only after all hooks finish. You may need to defer actions until after the transaction commits (for example, by queueing the action or triggering it from a post-commit lifecycle event) (discussion).

Let me know if you want example config for switching drivers or have questions about patching adapter options for transactionless environments.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Sep 18, 2025): <!-- Greeting --> Hi @TheOrcDev! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> This error happens because Better Auth now expects database transaction support for user creation and social login flows, but the neon-http driver (`drizzle-orm/neon-http` with `@neondatabase/serverless`) does not support transactions. When Better Auth tries to run user/account/session creation inside a transaction, it fails and surfaces the error ["No transactions support in neon-http driver - unable_to_create_user"](https://github.com/better-auth/better-auth/pull/4414). There’s no built-in workaround for transactionless drivers in Better Auth. Disabling transactions globally (by setting `transaction: false` in your adapter config) is possible for some adapters, but it’s risky and not recommended unless you’re only targeting databases that lack transaction support, since it compromises data integrity and atomicity for multi-step operations like signup and social login ([docs](https://github.com/better-auth/better-auth/pull/4532)). **Recommended solution:** Switch to a Postgres driver for Drizzle ORM that supports transactions, such as `drizzle-orm/node-postgres` or `drizzle-orm/postgres-js`. These drivers work with Better Auth’s transaction requirements and will avoid this error. If you need serverless compatibility and must use Neon, you’ll need to track upstream changes for transaction support in the neon-http driver, or consider using Neon’s pooled connection driver (which supports transactions) if your deployment allows it. If you have after-hooks or plugins that depend on immediate database visibility of the user, be aware that Better Auth commits the transaction only after all hooks finish. You may need to defer actions until after the transaction commits (for example, by queueing the action or triggering it from a post-commit lifecycle event) ([discussion](https://github.com/better-auth/better-auth/issues/4718#issuecomment-3302288221)). Let me know if you want example config for switching drivers or have questions about patching adapter options for transactionless environments. <!-- 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/ca1a1fa9-f2bb-48c0-b2ba-f50c25bf7af8?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/ca1a1fa9-f2bb-48c0-b2ba-f50c25bf7af8?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/ca1a1fa9-f2bb-48c0-b2ba-f50c25bf7af8?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/ca1a1fa9-f2bb-48c0-b2ba-f50c25bf7af8?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/ca1a1fa9-f2bb-48c0-b2ba-f50c25bf7af8?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/ca1a1fa9-f2bb-48c0-b2ba-f50c25bf7af8?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/ca1a1fa9-f2bb-48c0-b2ba-f50c25bf7af8?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&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/4747)
Author
Owner

@TheOrcDev commented on GitHub (Sep 18, 2025):

Email provider is working.

@TheOrcDev commented on GitHub (Sep 18, 2025): Email provider is working.
Author
Owner

@TheOrcDev commented on GitHub (Sep 18, 2025):

I fixed it by downgrading to version 1.3.9

The problem is in this transactions update here: https://www.better-auth.com/changelogs#v1.3.10

@TheOrcDev commented on GitHub (Sep 18, 2025): I fixed it by downgrading to version `1.3.9` The problem is in this transactions update here: https://www.better-auth.com/changelogs#v1.3.10
Author
Owner

@Bekacru commented on GitHub (Sep 18, 2025):

should be addressed on 1.3.12

@Bekacru commented on GitHub (Sep 18, 2025): should be addressed on 1.3.12
Author
Owner

@TheOrcDev commented on GitHub (Sep 18, 2025):

should be addressed on 1.3.12

Thanks @Bekacru

@TheOrcDev commented on GitHub (Sep 18, 2025): > should be addressed on 1.3.12 Thanks @Bekacru
Author
Owner

@TheOrcDev commented on GitHub (Sep 19, 2025):

should be addressed on 1.3.12

I can confirm it's working in 1.3.12

@TheOrcDev commented on GitHub (Sep 19, 2025): > should be addressed on 1.3.12 I can confirm it's working in 1.3.12
Author
Owner

@fl0wo commented on GitHub (Sep 19, 2025):

Not working in 1.3.12 for drizzle-orm/d1

@fl0wo commented on GitHub (Sep 19, 2025): Not working in 1.3.12 for `drizzle-orm/d1`
Author
Owner

@himself65 commented on GitHub (Sep 19, 2025):

Working or not working?

@himself65 commented on GitHub (Sep 19, 2025): Working or not working?
Author
Owner

@joseandro commented on GitHub (Sep 20, 2025):

Same issue using 1.3.13 with drizzle-orm/d1. I could only get it to work with d1 by downgrading it to 1.3.9.

@joseandro commented on GitHub (Sep 20, 2025): Same issue using 1.3.13 with `drizzle-orm/d1`. I could only get it to work with d1 by downgrading it to 1.3.9.
Author
Owner

@jslno commented on GitHub (Oct 10, 2025):

Same issue using 1.3.13 with drizzle-orm/d1. I could only get it to work with d1 by downgrading it to 1.3.9.

Maybe a bit late, I randomly came across this. D1 only supports batching, so transactions won't work. You'll have to manually disable transactions in your adapter config.

@jslno commented on GitHub (Oct 10, 2025): > Same issue using 1.3.13 with `drizzle-orm/d1`. I could only get it to work with d1 by downgrading it to 1.3.9. Maybe a bit late, I randomly came across this. D1 only supports batching, so transactions won't work. You'll have to manually disable transactions in your adapter config.
Author
Owner

@himself65 commented on GitHub (Oct 10, 2025):

I think transaction is disabled by default in the latest version

@himself65 commented on GitHub (Oct 10, 2025): I think transaction is disabled by default in the latest version
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1962