[GH-ISSUE #6277] Prisma v7 Issues w/ Better Auth CLI Generate #27792

Closed
opened 2026-04-17 19:00:41 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @JeffreyLind3 on GitHub (Nov 24, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/6277

When running npx @better-auth/cli generate and using Prisma, it generates a Prisma schema, schema.prisma, with the property url = env("DATABASE_URL"), the property provider = "prisma-client-js", and so forth.

However, in Prisma v7, fields like url are now moved to a separate prisma.config.ts file, provider should now be prisma-client to use the new Rust-free implementation (recommended by Prisma), and so forth.

Migration docs

Originally created by @JeffreyLind3 on GitHub (Nov 24, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/6277 When running `npx @better-auth/cli generate` and using Prisma, it generates a Prisma schema, `schema.prisma`, with the property `url = env("DATABASE_URL")`, the property `provider = "prisma-client-js"`, and so forth. However, in Prisma v7, fields like `url` are now moved to a separate `prisma.config.ts` file, `provider` should now be `prisma-client` to use the new Rust-free implementation (recommended by Prisma), and so forth. [Migration docs](https://www.prisma.io/docs/orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-7)
GiteaMirror added the locked label 2026-04-17 19:00:41 -05:00
Author
Owner

@better-auth-agent[bot] commented on GitHub (Nov 24, 2025):

Thanks for raising this issue! It appears that when using Prisma v7, the CLI still generates a schema that uses legacy properties like the DATABASE_URL in the schema file and sets the provider to "prisma-client-js," while Prisma’s new approach now expects these configurations in a separate prisma.config.ts file with a provider value of "prisma-client." Our current recommendation is to manually update the generated schema based on Prisma’s migration guide after running the CLI generate command. We're aware of this misalignment and are considering an update that automatically handles Prisma v7’s changes in a future release.

Have you tried adjusting the schema manually after generation, and did that resolve the issue on your end? Tag @better-auth-agent if you would like an answer from the Agent.

DiagramDiscordGitHub

Diagram Join Star

<!-- gh-comment-id:3572720040 --> @better-auth-agent[bot] commented on GitHub (Nov 24, 2025): Thanks for raising this issue! It appears that when using Prisma v7, the CLI still generates a schema that uses legacy properties like the DATABASE_URL in the schema file and sets the provider to "prisma-client-js," while Prisma’s new approach now expects these configurations in a separate prisma.config.ts file with a provider value of "prisma-client." Our current recommendation is to manually update the generated schema based on Prisma’s migration guide after running the CLI generate command. We're aware of this misalignment and are considering an update that automatically handles Prisma v7’s changes in a future release. Have you tried adjusting the schema manually after generation, and did that resolve the issue on your end? Tag @better-auth-agent if you would like an answer from the Agent. <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) • [Discord](https://discord.gg/better-auth) • [GitHub](https://github.com/better-auth/better-auth) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/better-auth) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/better-auth/better-auth)
Author
Owner

@dosubot[bot] commented on GitHub (Nov 24, 2025):

Prisma v7 introduces breaking changes that make the current Better Auth CLI Prisma schema generation incompatible. The CLI still outputs a generator block with provider = "prisma-client-js" and a datasource block with url = env("DATABASE_URL"), which is the old Prisma v6 style. In Prisma v7, you must move connection settings like url to a new prisma.config.ts file, and the generator block should use provider = "prisma-client" to enable the new Rust-free client. The CLI does not generate or reference prisma.config.ts, nor does it update the provider value as required by Prisma v7. This means manual intervention is needed after each CLI run to update the generated schema and config files for Prisma v7 compatibility cite.

To work around this, after running the CLI, you should:

  1. Move the url, directUrl, and shadowDatabaseUrl fields from the datasource block in schema.prisma to a new prisma.config.ts file as described in the Prisma v7 migration guide.
  2. Change the generator block's provider from "prisma-client-js" to "prisma-client".
  3. Update your import paths to use the generated client (e.g., import { PrismaClient } from "@/generated/prisma/client").
  4. Explicitly use the appropriate Prisma adapter package (like @prisma/adapter-pg for Postgres).
  5. Manually repeat these changes after each CLI run, as the CLI will overwrite the schema with the old format.

There are no automatic migrations or CLI support for Prisma v7 yet, so these manual steps are required for now cite cite. The maintainers are aware that the documentation and generator need updating for Prisma v7, but no official CLI support has landed yet.

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:3572729547 --> @dosubot[bot] commented on GitHub (Nov 24, 2025): <!-- Answer --> Prisma v7 introduces breaking changes that make the current Better Auth CLI Prisma schema generation incompatible. The CLI still outputs a generator block with `provider = "prisma-client-js"` and a datasource block with `url = env("DATABASE_URL")`, which is the old Prisma v6 style. In Prisma v7, you must move connection settings like `url` to a new `prisma.config.ts` file, and the generator block should use `provider = "prisma-client"` to enable the new Rust-free client. The CLI does not generate or reference `prisma.config.ts`, nor does it update the provider value as required by Prisma v7. This means manual intervention is needed after each CLI run to update the generated schema and config files for Prisma v7 compatibility [cite](https://github.com/better-auth/better-auth/blob/fc662c52dcadc9874d36bd354d53d23f8a24e098/packages/cli/src/generators/prisma.ts#L11-L445). To work around this, after running the CLI, you should: 1. Move the `url`, `directUrl`, and `shadowDatabaseUrl` fields from the datasource block in `schema.prisma` to a new `prisma.config.ts` file as described in the [Prisma v7 migration guide](https://www.prisma.io/docs/orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-7). 2. Change the generator block's provider from `"prisma-client-js"` to `"prisma-client"`. 3. Update your import paths to use the generated client (e.g., `import { PrismaClient } from "@/generated/prisma/client"`). 4. Explicitly use the appropriate Prisma adapter package (like `@prisma/adapter-pg` for Postgres). 5. Manually repeat these changes after each CLI run, as the CLI will overwrite the schema with the old format. There are no automatic migrations or CLI support for Prisma v7 yet, so these manual steps are required for now [cite](https://github.com/better-auth/better-auth/issues/6112) [cite](https://github.com/better-auth/better-auth/pull/4665). The maintainers are aware that the documentation and generator need updating for Prisma v7, but no official CLI support has landed yet. <!-- 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/e3357fcd-9256-409b-b1b9-8c8b463f5236?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/e3357fcd-9256-409b-b1b9-8c8b463f5236?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/e3357fcd-9256-409b-b1b9-8c8b463f5236?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/e3357fcd-9256-409b-b1b9-8c8b463f5236?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/e3357fcd-9256-409b-b1b9-8c8b463f5236?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/e3357fcd-9256-409b-b1b9-8c8b463f5236?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/e3357fcd-9256-409b-b1b9-8c8b463f5236?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=Prisma%20v7%20introduces%20breaking%20changes%20that%20make%20the%20current%20Better%20Auth%20CLI%20Prisma%20schema%20generation%20incompatible.%20The%20CLI%20still%20outputs%20a%20generator%20block%20with%20%60provider%20%3D%20%22prisma-client-js%22%60%20and%20a%20datasource%20block%20with%20%60url%20%3D%20env%28%22DATABASE_URL%22%29%60%2C%20which%20is%20the%20old%20Prisma%20v6%20style.%20In%20Prisma%20v7%2C%20you%20must%20move%20connection%20settings%20like%20%60url%60%20to%20a%20new%20%60prisma.config.ts%60%20file%2C%20and%20the%20generator%20block%20should%20use%20%60provider%20%3D%20%22prisma-client%22%60%20to%20enable%20the%20new%20Rust-free%20client.%20The%20CLI%20does%20not%20generate%20or%20reference%20%60prisma.config.ts%60%2C%20nor%20does%20it%20update%20the%20provider%20value%20as%20required%20by%20Prisma%20v7.%20This%20means%20manual%20intervention%20is%20needed%20after%20each%20CLI%20run%20to%20update%20the%20generated%20schema%20and%20config%20files%20for%20Prisma%20v7%20compatibility%C2%A0%5Bcite%5D%28https%3A//github.com/better-auth/better-auth/blob/fc662c52dcadc9874d36bd354d53d23f8a24e098/packages/cli/src/generators/prisma.ts%23L11-L445%29.%0A%0ATo%20work%20around%20this%2C%20after%20running%20the%20CLI%2C%20you%20should%3A%0A1.%20Move%20the%20%60url%60%2C%20%60directUrl%60%2C%20and%20%60shadowDatabaseUrl%60%20fields%20from%20the%20datasource%20block%20in%20%60schema.prisma%60%20to%20a%20new%20%60prisma.config.ts%60%20file%20as%20described%20in%20the%20%5BPrisma%20v7%20migration%20guide%5D%28https%3A//www.prisma.io/docs/orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-7%29.%0A2.%20Change%20the%20generator%20block%27s%20provider%20from%20%60%22prisma-client-js%22%60%20to%20%60%22prisma-client%22%60.%0A3.%20Update%20your%20import%20paths%20to%20use%20the%20generated%20client%20%28e.g.%2C%20%60import%20%7B%20PrismaClient%20%7D%20from%20%22%40/generated/prisma/client%22%60%29.%0A4.%20Explicitly%20use%20the%20appropriate%20Prisma%20adapter%20package%20%28like%20%60%40prisma/adapter-pg%60%20for%20Postgres%29.%0A5.%20Manually%20repeat%20these%20changes%20after%20each%20CLI%20run%2C%20as%20the%20CLI%20will%20overwrite%20the%20schema%20with%20the%20old%20format.%0A%0AThere%20are%20no%20automatic%20migrations%20or%20CLI%20support%20for%20Prisma%20v7%20yet%2C%20so%20these%20manual%20steps%20are%20required%20for%20now%C2%A0%5Bcite%5D%28https%3A//github.com/better-auth/better-auth/issues/6112%29%C2%A0%5Bcite%5D%28https%3A//github.com/better-auth/better-auth/pull/4665%29.%20The%20maintainers%20are%20aware%20that%20the%20documentation%20and%20generator%20need%20updating%20for%20Prisma%20v7%2C%20but%20no%20official%20CLI%20support%20has%20landed%20yet.)&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/6277)
Author
Owner

@himself65 commented on GitHub (Dec 1, 2025):

Have you followed https://www.prisma.io/docs/guides/betterauth-nextjs?

<!-- gh-comment-id:3599130807 --> @himself65 commented on GitHub (Dec 1, 2025): Have you followed https://www.prisma.io/docs/guides/betterauth-nextjs?
Author
Owner

@himself65 commented on GitHub (Dec 1, 2025):

ok I think it's our issue, I'm working on this

<!-- gh-comment-id:3599150022 --> @himself65 commented on GitHub (Dec 1, 2025): ok I think it's our issue, I'm working on this
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#27792