[GH-ISSUE #8272] SyntaxError: The requested module 'better-auth/db' does not provide an export named 'getMigrations' #19672

Closed
opened 2026-04-15 18:57:53 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @IgnisDa on GitHub (Mar 2, 2026).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/8272

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

I am trying to upgrade my application from "better-auth": "1.4.18" to "better-auth": "1.5.0". But I get this error:

ra-rewrite) [SIGINT]> npx @better-auth/cli generate --output src/db/schema/auth.ts
Need to install the following packages:
@better-auth/cli@1.4.20
Ok to proceed? (y) 

npm warn deprecated prebuild-install@7.1.3: No longer maintained. Please contact the author of the relevant native addon; alternatives are available.
file:///Users/diptesh/.npm/_npx/167ca1f116d365e6/node_modules/@better-auth/cli/dist/generators-Ht8QYIi_.mjs:4
import { getAuthTables, getMigrations } from "better-auth/db";
                        ^^^^^^^^^^^^^
SyntaxError: The requested module 'better-auth/db' does not provide an export named 'getMigrations'
    at #_instantiate (node:internal/modules/esm/module_job:210:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:295:5)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:663:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:99:5)

Node.js v24.0.0
diptesh@192 ~/D/C/r/a/app-backend (ultra-rewrite) [1]> bunx --bun @better-auth/cli generate --output src/db/schema/auth.ts
1 | })
2 | {
    ^
SyntaxError: Export named 'getMigrations' not found in module '/private/var/folders/3q/pnnjs6pn50v3tcl3knwgstpm0000gn/T/bunx-501-@better-auth/cli@latest/node_modules/better-auth/dist/db/index.mjs'.
      at loadAndEvaluateModule (2:1)

Bun v1.3.9 (macOS arm64)

Current vs. Expected behavior

I am expecting the migration files to be generated correctly.

What version of Better Auth are you using?

1.5.0

System info

{
  "system": {
    "platform": "darwin",
    "arch": "arm64",
    "version": "Darwin Kernel Version 25.3.0: Wed Jan 28 20:53:15 PST 2026; root:xnu-12377.81.4~5/RELEASE_ARM64_T6000",
    "release": "25.3.0",
    "cpuCount": 8,
    "cpuModel": "Apple M1 Pro",
    "totalMemory": "16.00 GB",
    "freeMemory": "0.16 GB"
  },
  "node": {
    "version": "v24.0.0",
    "env": "development"
  },
  "packageManager": {
    "name": "bun",
    "version": "1.3.9"
  },
  "frameworks": [
    {
      "name": "hono",
      "version": "4.12.1"
    }
  ],
  "databases": [
    {
      "name": "pg",
      "version": "8.18.0"
    },
    {
      "name": "drizzle",
      "version": "0.45.1"
    }
  ],
  "betterAuth": {
    "version": "1.5.0",
    "config": {
      "baseURL": "http://localhost:8000",
      "emailAndPassword": {
        "enabled": true
      },
      "secret": "[REDACTED]",
      "plugins": [
        {
          "name": "api-key",
          "config": {
            "id": "api-key",
            "$ERROR_CODES": {
              "INVALID_METADATA_TYPE": {
                "code": "INVALID_METADATA_TYPE",
                "message": "metadata must be an object or undefined"
              },
              "REFILL_AMOUNT_AND_INTERVAL_REQUIRED": {
                "code": "REFILL_AMOUNT_AND_INTERVAL_REQUIRED",
                "message": "refillAmount is required when refillInterval is provided"
              },
              "REFILL_INTERVAL_AND_AMOUNT_REQUIRED": {
                "code": "REFILL_INTERVAL_AND_AMOUNT_REQUIRED",
                "message": "refillInterval is required when refillAmount is provided"
              },
              "USER_BANNED": {
                "code": "USER_BANNED",
                "message": "User is banned"
              },
              "UNAUTHORIZED_SESSION": {
                "code": "UNAUTHORIZED_SESSION",
                "message": "Unauthorized or invalid session"
              },
              "KEY_NOT_FOUND": {
                "code": "KEY_NOT_FOUND",
                "message": "API Key not found"
              },
              "KEY_DISABLED": {
                "code": "KEY_DISABLED",
                "message": "API Key is disabled"
              },
              "KEY_EXPIRED": {
                "code": "KEY_EXPIRED",
                "message": "API Key has expired"
              },
              "USAGE_EXCEEDED": {
                "code": "USAGE_EXCEEDED",
                "message": "API Key has reached its usage limit"
              },
              "KEY_NOT_RECOVERABLE": {
                "code": "KEY_NOT_RECOVERABLE",
                "message": "API Key is not recoverable"
              },
              "EXPIRES_IN_IS_TOO_SMALL": {
                "code": "EXPIRES_IN_IS_TOO_SMALL",
                "message": "The expiresIn is smaller than the predefined minimum value."
              },
              "EXPIRES_IN_IS_TOO_LARGE": {
                "code": "EXPIRES_IN_IS_TOO_LARGE",
                "message": "The expiresIn is larger than the predefined maximum value."
              },
              "INVALID_REMAINING": {
                "code": "INVALID_REMAINING",
                "message": "The remaining count is either too large or too small."
              },
              "INVALID_PREFIX_LENGTH": {
                "code": "INVALID_PREFIX_LENGTH",
                "message": "The prefix length is either too large or too small."
              },
              "INVALID_NAME_LENGTH": {
                "code": "INVALID_NAME_LENGTH",
                "message": "The name length is either too large or too small."
              },
              "METADATA_DISABLED": {
                "code": "METADATA_DISABLED",
                "message": "Metadata is disabled."
              },
              "RATE_LIMIT_EXCEEDED": {
                "code": "RATE_LIMIT_EXCEEDED",
                "message": "Rate limit exceeded."
              },
              "NO_VALUES_TO_UPDATE": {
                "code": "NO_VALUES_TO_UPDATE",
                "message": "No values to update."
              },
              "KEY_DISABLED_EXPIRATION": {
                "code": "KEY_DISABLED_EXPIRATION",
                "message": "Custom key expiration values are disabled."
              },
              "INVALID_API_KEY": {
                "code": "INVALID_API_KEY",
                "message": "Invalid API key."
              },
              "INVALID_USER_ID_FROM_API_KEY": {
                "code": "INVALID_USER_ID_FROM_API_KEY",
                "message": "The user id from the API key is invalid."
              },
              "INVALID_REFERENCE_ID_FROM_API_KEY": {
                "code": "INVALID_REFERENCE_ID_FROM_API_KEY",
                "message": "The reference id from the API key is invalid."
              },
              "INVALID_API_KEY_GETTER_RETURN_TYPE": {
                "code": "INVALID_API_KEY_GETTER_RETURN_TYPE",
                "message": "API Key getter returned an invalid key type. Expected string."
              },
              "SERVER_ONLY_PROPERTY": {
                "code": "SERVER_ONLY_PROPERTY",
                "message": "The property you're trying to set can only be set from the server auth instance only."
              },
              "FAILED_TO_UPDATE_API_KEY": {
                "code": "FAILED_TO_UPDATE_API_KEY",
                "message": "Failed to update API key"
              },
              "NAME_REQUIRED": {
                "code": "NAME_REQUIRED",
                "message": "API Key name is required."
              },
              "ORGANIZATION_ID_REQUIRED": {
                "code": "ORGANIZATION_ID_REQUIRED",
                "message": "Organization ID is required for organization-owned API keys."
              },
              "USER_NOT_MEMBER_OF_ORGANIZATION": {
                "code": "USER_NOT_MEMBER_OF_ORGANIZATION",
                "message": "You are not a member of the organization that owns this API key."
              },
              "INSUFFICIENT_API_KEY_PERMISSIONS": {
                "code": "INSUFFICIENT_API_KEY_PERMISSIONS",
                "message": "You do not have permission to perform this action on organization API keys."
              },
              "NO_DEFAULT_API_KEY_CONFIGURATION_FOUND": {
                "code": "NO_DEFAULT_API_KEY_CONFIGURATION_FOUND",
                "message": "No default api-key configuration found."
              },
              "ORGANIZATION_PLUGIN_REQUIRED": {
                "code": "ORGANIZATION_PLUGIN_REQUIRED",
                "message": "Organization plugin is required for organization-owned API keys. Please install and configure the organization plugin."
              }
            },
            "hooks": {
              "before": [
                {}
              ]
            },
            "endpoints": {},
            "schema": {
              "apikey": {
                "fields": {
                  "configId": {
                    "type": "string",
                    "required": true,
                    "defaultValue": "default",
                    "input": false,
                    "index": true
                  },
                  "name": {
                    "type": "string",
                    "required": false,
                    "input": false
                  },
                  "start": {
                    "type": "string",
                    "required": false,
                    "input": false
                  },
                  "referenceId": {
                    "type": "string",
                    "required": true,
                    "input": false,
                    "index": true
                  },
                  "prefix": {
                    "type": "string",
                    "required": false,
                    "input": false
                  },
                  "key": {
                    "type": "string",
                    "required": true,
                    "input": false,
                    "index": true
                  },
                  "refillInterval": {
                    "type": "number",
                    "required": false,
                    "input": false
                  },
                  "refillAmount": {
                    "type": "number",
                    "required": false,
                    "input": false
                  },
                  "lastRefillAt": {
                    "type": "date",
                    "required": false,
                    "input": false
                  },
                  "enabled": {
                    "type": "boolean",
                    "required": false,
                    "input": false,
                    "defaultValue": true
                  },
                  "rateLimitEnabled": {
                    "type": "boolean",
                    "required": false,
                    "input": false,
                    "defaultValue": true
                  },
                  "rateLimitTimeWindow": {
                    "type": "number",
                    "required": false,
                    "input": false,
                    "defaultValue": 86400000
                  },
                  "rateLimitMax": {
                    "type": "number",
                    "required": false,
                    "input": false,
                    "defaultValue": 10
                  },
                  "requestCount": {
                    "type": "number",
                    "required": false,
                    "input": false,
                    "defaultValue": 0
                  },
                  "remaining": {
                    "type": "number",
                    "required": false,
                    "input": false
                  },
                  "lastRequest": {
                    "type": "date",
                    "required": false,
                    "input": false
                  },
                  "expiresAt": {
                    "type": "date",
                    "required": false,
                    "input": false
                  },
                  "createdAt": {
                    "type": "date",
                    "required": true,
                    "input": false
                  },
                  "updatedAt": {
                    "type": "date",
                    "required": true,
                    "input": false
                  },
                  "permissions": {
                    "type": "string",
                    "required": false,
                    "input": false
                  },
                  "metadata": {
                    "type": "string",
                    "required": false,
                    "input": true,
                    "transform": {}
                  }
                }
              }
            },
            "configurations": [
              {
                "enableSessionForAPIKeys": true,
                "apiKeyHeaders": "x-api-key",
                "defaultKeyLength": 64,
                "maximumPrefixLength": 32,
                "minimumPrefixLength": 1,
                "maximumNameLength": 32,
                "minimumNameLength": 1,
                "enableMetadata": false,
                "disableKeyHashing": false,
                "requireName": false,
                "storage": "database",
                "rateLimit": {
                  "enabled": true,
                  "timeWindow": 86400000,
                  "maxRequests": 10
                },
                "keyExpiration": {
                  "defaultExpiresIn": null,
                  "disableCustomExpiresTime": false,
                  "maxExpiresIn": 365,
                  "minExpiresIn": 1
                },
                "startingCharactersConfig": {
                  "shouldStore": true,
                  "charactersLength": 6
                },
                "fallbackToDatabase": false,
                "deferUpdates": false
              }
            ]
          }
        }
      ]
    }
  }
}

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

Backend

Auth config (if applicable)

import { apiKey } from "@better-auth/api-key";
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { db, schema } from "~/db";
import { config } from "~/lib/config";

export const auth = betterAuth({
	baseURL: config.FRONTEND_URL,
	emailAndPassword: { enabled: true },
	secret: config.SERVER_ADMIN_ACCESS_TOKEN,
	database: drizzleAdapter(db, { provider: "pg", schema }),
	plugins: [apiKey({ enableSessionForAPIKeys: true })],
});

Additional context

No response

Originally created by @IgnisDa on GitHub (Mar 2, 2026). Original GitHub issue: https://github.com/better-auth/better-auth/issues/8272 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce I am trying to upgrade my application from `"better-auth": "1.4.18"` to `"better-auth": "1.5.0"`. But I get this error: ``` ra-rewrite) [SIGINT]> npx @better-auth/cli generate --output src/db/schema/auth.ts Need to install the following packages: @better-auth/cli@1.4.20 Ok to proceed? (y) npm warn deprecated prebuild-install@7.1.3: No longer maintained. Please contact the author of the relevant native addon; alternatives are available. file:///Users/diptesh/.npm/_npx/167ca1f116d365e6/node_modules/@better-auth/cli/dist/generators-Ht8QYIi_.mjs:4 import { getAuthTables, getMigrations } from "better-auth/db"; ^^^^^^^^^^^^^ SyntaxError: The requested module 'better-auth/db' does not provide an export named 'getMigrations' at #_instantiate (node:internal/modules/esm/module_job:210:21) at async ModuleJob.run (node:internal/modules/esm/module_job:295:5) at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:663:26) at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:99:5) Node.js v24.0.0 diptesh@192 ~/D/C/r/a/app-backend (ultra-rewrite) [1]> bunx --bun @better-auth/cli generate --output src/db/schema/auth.ts 1 | }) 2 | { ^ SyntaxError: Export named 'getMigrations' not found in module '/private/var/folders/3q/pnnjs6pn50v3tcl3knwgstpm0000gn/T/bunx-501-@better-auth/cli@latest/node_modules/better-auth/dist/db/index.mjs'. at loadAndEvaluateModule (2:1) Bun v1.3.9 (macOS arm64) ``` ### Current vs. Expected behavior I am expecting the migration files to be generated correctly. ### What version of Better Auth are you using? 1.5.0 ### System info ```bash { "system": { "platform": "darwin", "arch": "arm64", "version": "Darwin Kernel Version 25.3.0: Wed Jan 28 20:53:15 PST 2026; root:xnu-12377.81.4~5/RELEASE_ARM64_T6000", "release": "25.3.0", "cpuCount": 8, "cpuModel": "Apple M1 Pro", "totalMemory": "16.00 GB", "freeMemory": "0.16 GB" }, "node": { "version": "v24.0.0", "env": "development" }, "packageManager": { "name": "bun", "version": "1.3.9" }, "frameworks": [ { "name": "hono", "version": "4.12.1" } ], "databases": [ { "name": "pg", "version": "8.18.0" }, { "name": "drizzle", "version": "0.45.1" } ], "betterAuth": { "version": "1.5.0", "config": { "baseURL": "http://localhost:8000", "emailAndPassword": { "enabled": true }, "secret": "[REDACTED]", "plugins": [ { "name": "api-key", "config": { "id": "api-key", "$ERROR_CODES": { "INVALID_METADATA_TYPE": { "code": "INVALID_METADATA_TYPE", "message": "metadata must be an object or undefined" }, "REFILL_AMOUNT_AND_INTERVAL_REQUIRED": { "code": "REFILL_AMOUNT_AND_INTERVAL_REQUIRED", "message": "refillAmount is required when refillInterval is provided" }, "REFILL_INTERVAL_AND_AMOUNT_REQUIRED": { "code": "REFILL_INTERVAL_AND_AMOUNT_REQUIRED", "message": "refillInterval is required when refillAmount is provided" }, "USER_BANNED": { "code": "USER_BANNED", "message": "User is banned" }, "UNAUTHORIZED_SESSION": { "code": "UNAUTHORIZED_SESSION", "message": "Unauthorized or invalid session" }, "KEY_NOT_FOUND": { "code": "KEY_NOT_FOUND", "message": "API Key not found" }, "KEY_DISABLED": { "code": "KEY_DISABLED", "message": "API Key is disabled" }, "KEY_EXPIRED": { "code": "KEY_EXPIRED", "message": "API Key has expired" }, "USAGE_EXCEEDED": { "code": "USAGE_EXCEEDED", "message": "API Key has reached its usage limit" }, "KEY_NOT_RECOVERABLE": { "code": "KEY_NOT_RECOVERABLE", "message": "API Key is not recoverable" }, "EXPIRES_IN_IS_TOO_SMALL": { "code": "EXPIRES_IN_IS_TOO_SMALL", "message": "The expiresIn is smaller than the predefined minimum value." }, "EXPIRES_IN_IS_TOO_LARGE": { "code": "EXPIRES_IN_IS_TOO_LARGE", "message": "The expiresIn is larger than the predefined maximum value." }, "INVALID_REMAINING": { "code": "INVALID_REMAINING", "message": "The remaining count is either too large or too small." }, "INVALID_PREFIX_LENGTH": { "code": "INVALID_PREFIX_LENGTH", "message": "The prefix length is either too large or too small." }, "INVALID_NAME_LENGTH": { "code": "INVALID_NAME_LENGTH", "message": "The name length is either too large or too small." }, "METADATA_DISABLED": { "code": "METADATA_DISABLED", "message": "Metadata is disabled." }, "RATE_LIMIT_EXCEEDED": { "code": "RATE_LIMIT_EXCEEDED", "message": "Rate limit exceeded." }, "NO_VALUES_TO_UPDATE": { "code": "NO_VALUES_TO_UPDATE", "message": "No values to update." }, "KEY_DISABLED_EXPIRATION": { "code": "KEY_DISABLED_EXPIRATION", "message": "Custom key expiration values are disabled." }, "INVALID_API_KEY": { "code": "INVALID_API_KEY", "message": "Invalid API key." }, "INVALID_USER_ID_FROM_API_KEY": { "code": "INVALID_USER_ID_FROM_API_KEY", "message": "The user id from the API key is invalid." }, "INVALID_REFERENCE_ID_FROM_API_KEY": { "code": "INVALID_REFERENCE_ID_FROM_API_KEY", "message": "The reference id from the API key is invalid." }, "INVALID_API_KEY_GETTER_RETURN_TYPE": { "code": "INVALID_API_KEY_GETTER_RETURN_TYPE", "message": "API Key getter returned an invalid key type. Expected string." }, "SERVER_ONLY_PROPERTY": { "code": "SERVER_ONLY_PROPERTY", "message": "The property you're trying to set can only be set from the server auth instance only." }, "FAILED_TO_UPDATE_API_KEY": { "code": "FAILED_TO_UPDATE_API_KEY", "message": "Failed to update API key" }, "NAME_REQUIRED": { "code": "NAME_REQUIRED", "message": "API Key name is required." }, "ORGANIZATION_ID_REQUIRED": { "code": "ORGANIZATION_ID_REQUIRED", "message": "Organization ID is required for organization-owned API keys." }, "USER_NOT_MEMBER_OF_ORGANIZATION": { "code": "USER_NOT_MEMBER_OF_ORGANIZATION", "message": "You are not a member of the organization that owns this API key." }, "INSUFFICIENT_API_KEY_PERMISSIONS": { "code": "INSUFFICIENT_API_KEY_PERMISSIONS", "message": "You do not have permission to perform this action on organization API keys." }, "NO_DEFAULT_API_KEY_CONFIGURATION_FOUND": { "code": "NO_DEFAULT_API_KEY_CONFIGURATION_FOUND", "message": "No default api-key configuration found." }, "ORGANIZATION_PLUGIN_REQUIRED": { "code": "ORGANIZATION_PLUGIN_REQUIRED", "message": "Organization plugin is required for organization-owned API keys. Please install and configure the organization plugin." } }, "hooks": { "before": [ {} ] }, "endpoints": {}, "schema": { "apikey": { "fields": { "configId": { "type": "string", "required": true, "defaultValue": "default", "input": false, "index": true }, "name": { "type": "string", "required": false, "input": false }, "start": { "type": "string", "required": false, "input": false }, "referenceId": { "type": "string", "required": true, "input": false, "index": true }, "prefix": { "type": "string", "required": false, "input": false }, "key": { "type": "string", "required": true, "input": false, "index": true }, "refillInterval": { "type": "number", "required": false, "input": false }, "refillAmount": { "type": "number", "required": false, "input": false }, "lastRefillAt": { "type": "date", "required": false, "input": false }, "enabled": { "type": "boolean", "required": false, "input": false, "defaultValue": true }, "rateLimitEnabled": { "type": "boolean", "required": false, "input": false, "defaultValue": true }, "rateLimitTimeWindow": { "type": "number", "required": false, "input": false, "defaultValue": 86400000 }, "rateLimitMax": { "type": "number", "required": false, "input": false, "defaultValue": 10 }, "requestCount": { "type": "number", "required": false, "input": false, "defaultValue": 0 }, "remaining": { "type": "number", "required": false, "input": false }, "lastRequest": { "type": "date", "required": false, "input": false }, "expiresAt": { "type": "date", "required": false, "input": false }, "createdAt": { "type": "date", "required": true, "input": false }, "updatedAt": { "type": "date", "required": true, "input": false }, "permissions": { "type": "string", "required": false, "input": false }, "metadata": { "type": "string", "required": false, "input": true, "transform": {} } } } }, "configurations": [ { "enableSessionForAPIKeys": true, "apiKeyHeaders": "x-api-key", "defaultKeyLength": 64, "maximumPrefixLength": 32, "minimumPrefixLength": 1, "maximumNameLength": 32, "minimumNameLength": 1, "enableMetadata": false, "disableKeyHashing": false, "requireName": false, "storage": "database", "rateLimit": { "enabled": true, "timeWindow": 86400000, "maxRequests": 10 }, "keyExpiration": { "defaultExpiresIn": null, "disableCustomExpiresTime": false, "maxExpiresIn": 365, "minExpiresIn": 1 }, "startingCharactersConfig": { "shouldStore": true, "charactersLength": 6 }, "fallbackToDatabase": false, "deferUpdates": false } ] } } ] } } } ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript import { apiKey } from "@better-auth/api-key"; import { betterAuth } from "better-auth"; import { drizzleAdapter } from "better-auth/adapters/drizzle"; import { db, schema } from "~/db"; import { config } from "~/lib/config"; export const auth = betterAuth({ baseURL: config.FRONTEND_URL, emailAndPassword: { enabled: true }, secret: config.SERVER_ADMIN_ACCESS_TOKEN, database: drizzleAdapter(db, { provider: "pg", schema }), plugins: [apiKey({ enableSessionForAPIKeys: true })], }); ``` ### Additional context _No response_
GiteaMirror added the lockedbug labels 2026-04-15 18:57:53 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 2, 2026):

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

This is a version mismatch issue. When you run npx @better-auth/cli, it installed version 1.4.20, but your project has better-auth 1.5.0 installed. In version 1.5.0, getMigrations was moved from better-auth/db to better-auth/db/migration as part of a module reorganization.

Solution: Pin the CLI version to match your better-auth version:

npx @better-auth/cli@1.5.0 generate --output src/db/schema/auth.ts

Or using the shorter alias:

npx auth@1.5.0 generate --output src/db/schema/auth.ts

This is a known issue when npx fetches the latest CLI version without explicit pinning.

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

<!-- gh-comment-id:3981688235 --> @dosubot[bot] commented on GitHub (Mar 2, 2026): <!-- Greeting --> Hi @IgnisDa! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> This is a **version mismatch** issue. When you run `npx @better-auth/cli`, it installed version 1.4.20, but your project has better-auth 1.5.0 installed. In [version 1.5.0, `getMigrations` was moved from `better-auth/db` to `better-auth/db/migration`](https://github.com/better-auth/better-auth/pull/7467) as part of a module reorganization. **Solution**: Pin the CLI version to match your better-auth version: ```bash npx @better-auth/cli@1.5.0 generate --output src/db/schema/auth.ts ``` Or using the shorter alias: ```bash npx auth@1.5.0 generate --output src/db/schema/auth.ts ``` This is a [known issue](https://github.com/better-auth/better-auth/issues/8257) when npx fetches the latest CLI version without explicit pinning. <!-- 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/72603ca7-6bc0-4b70-8a08-3e9e4c492c1d?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/72603ca7-6bc0-4b70-8a08-3e9e4c492c1d?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/72603ca7-6bc0-4b70-8a08-3e9e4c492c1d?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/72603ca7-6bc0-4b70-8a08-3e9e4c492c1d?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/72603ca7-6bc0-4b70-8a08-3e9e4c492c1d?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/72603ca7-6bc0-4b70-8a08-3e9e4c492c1d?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/72603ca7-6bc0-4b70-8a08-3e9e4c492c1d?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=This%20is%20a%20%2A%2Aversion%20mismatch%2A%2A%20issue.%20When%20you%20run%20%60npx%20%40better-auth/cli%60%2C%20it%20installed%20version%201.4.20%2C%20but%20your%20project%20has%20better-auth%201.5.0%20installed.%20In%20%5Bversion%201.5.0%2C%20%60getMigrations%60%20was%20moved%20from%20%60better-auth/db%60%20to%20%60better-auth/db/migration%60%5D%28https%3A//github.com/better-auth/better-auth/pull/7467%29%20as%20part%20of%20a%20module%20reorganization.%0A%0A%2A%2ASolution%2A%2A%3A%20Pin%20the%20CLI%20version%20to%20match%20your%20better-auth%20version%3A%0A%0A%60%60%60bash%0Anpx%20%40better-auth/cli%401.5.0%20generate%20--output%20src/db/schema/auth.ts%0A%60%60%60%0A%0AOr%20using%20the%20shorter%20alias%3A%0A%60%60%60bash%0Anpx%20auth%401.5.0%20generate%20--output%20src/db/schema/auth.ts%0A%60%60%60%0A%0AThis%20is%20a%20%5Bknown%20issue%5D%28https%3A//github.com/better-auth/better-auth/issues/8257%29%20when%20npx%20fetches%20the%20latest%20CLI%20version%20without%20explicit%20pinning.)&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/8272)
Author
Owner

@IgnisDa commented on GitHub (Mar 2, 2026):

@dosu The package does not exist:

diptesh@192 ~/D/C/r/a/app-backend (ultra-rewrite)> bunx --bun @better-auth/cli@1.5.0 generate --output src/db/schema/auth.ts
error: No version matching "1.5.0" found for specifier "@better-auth/cli" (but package exists)
error: @better-auth/cli@1.5.0 failed to resolve

I checked on npm as well.

<!-- gh-comment-id:3981691314 --> @IgnisDa commented on GitHub (Mar 2, 2026): @dosu The package does not exist: ``` diptesh@192 ~/D/C/r/a/app-backend (ultra-rewrite)> bunx --bun @better-auth/cli@1.5.0 generate --output src/db/schema/auth.ts error: No version matching "1.5.0" found for specifier "@better-auth/cli" (but package exists) error: @better-auth/cli@1.5.0 failed to resolve ``` I checked on npm as well.
Author
Owner

@dosubot[bot] commented on GitHub (Mar 2, 2026):

Thanks for checking! The CLI package was renamed from @better-auth/cli to just auth. That's why 1.5.0 doesn't exist under the old name.

Try this instead:

bunx --bun auth generate --output src/db/schema/auth.ts

Or with npm:

npx auth generate --output src/db/schema/auth.ts

If you still hit the getMigrations export error, there may be a compatibility issue with the latest CLI and better-auth 1.5.0. In that case, try pinning to version 1.4.21:

bunx --bun auth@1.4.21 generate --output src/db/schema/auth.ts

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

<!-- gh-comment-id:3981694579 --> @dosubot[bot] commented on GitHub (Mar 2, 2026): <!-- Answer --> Thanks for checking! The CLI package was [renamed from `@better-auth/cli` to just `auth`](https://github.com/better-auth/better-auth/pull/7964). That's why 1.5.0 doesn't exist under the old name. Try this instead: ```bash bunx --bun auth generate --output src/db/schema/auth.ts ``` Or with npm: ```bash npx auth generate --output src/db/schema/auth.ts ``` If you still hit the `getMigrations` export error, there may be a [compatibility issue with the latest CLI and better-auth 1.5.0](https://github.com/better-auth/better-auth/issues/8257). In that case, try pinning to version 1.4.21: ```bash bunx --bun auth@1.4.21 generate --output src/db/schema/auth.ts ``` <!-- 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/1bf99bd4-79fd-4e19-b615-9cd5e06b2971?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/1bf99bd4-79fd-4e19-b615-9cd5e06b2971?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/1bf99bd4-79fd-4e19-b615-9cd5e06b2971?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/1bf99bd4-79fd-4e19-b615-9cd5e06b2971?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/1bf99bd4-79fd-4e19-b615-9cd5e06b2971?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/1bf99bd4-79fd-4e19-b615-9cd5e06b2971?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/1bf99bd4-79fd-4e19-b615-9cd5e06b2971?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=Thanks%20for%20checking%21%20The%20CLI%20package%20was%20%5Brenamed%20from%20%60%40better-auth/cli%60%20to%20just%20%60auth%60%5D%28https%3A//github.com/better-auth/better-auth/pull/7964%29.%20That%27s%20why%201.5.0%20doesn%27t%20exist%20under%20the%20old%20name.%0A%0ATry%20this%20instead%3A%0A%0A%60%60%60bash%0Abunx%20--bun%20auth%20generate%20--output%20src/db/schema/auth.ts%0A%60%60%60%0A%0AOr%20with%20npm%3A%0A%60%60%60bash%0Anpx%20auth%20generate%20--output%20src/db/schema/auth.ts%0A%60%60%60%0A%0AIf%20you%20still%20hit%20the%20%60getMigrations%60%20export%20error%2C%20there%20may%20be%20a%20%5Bcompatibility%20issue%20with%20the%20latest%20CLI%20and%20better-auth%201.5.0%5D%28https%3A//github.com/better-auth/better-auth/issues/8257%29.%20In%20that%20case%2C%20try%20pinning%20to%20version%201.4.21%3A%0A%0A%60%60%60bash%0Abunx%20--bun%20auth%401.4.21%20generate%20--output%20src/db/schema/auth.ts%0A%60%60%60)&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/8272)
Author
Owner

@IgnisDa commented on GitHub (Mar 2, 2026):

Thanks. It worked with bunx --bun auth generate --output src/db/schema/auth.ts. I missed it in the https://better-auth.com/changelog.

Can close this issue.

<!-- gh-comment-id:3981697263 --> @IgnisDa commented on GitHub (Mar 2, 2026): Thanks. It worked with `bunx --bun auth generate --output src/db/schema/auth.ts`. I missed it in the https://better-auth.com/changelog. Can close this issue.
Author
Owner
<!-- gh-comment-id:3981716149 --> @himself65 commented on GitHub (Mar 2, 2026): Fixes: https://github.com/better-auth/better-auth/actions/runs/22559367030/job/65342646916
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#19672