docs icon indicating copy to clipboard operation
docs copied to clipboard

fix: update path for generated prisma client to match the rest of the code

Open shrekuu opened this issue 2 weeks ago β€’ 1 comments

Reason: I am trying out the guide: How to use Prisma ORM with Better Auth and Next.js

When I run npx @better-auth/cli generate it gives me an error:

2025-12-06T07:30:02.092Z ERROR [Better Auth]: [#better-auth]: Couldn't read your auth config. Error: Cannot find module '/Users/myusername/repos/betterauth-nextjs-prisma/generated/prisma/client'
Require stack:
- /Users/myusername/repos/betterauth-nextjs-prisma/src/lib/prisma.ts
    at Module._resolveFilename (node:internal/modules/cjs/loader:1410:15)
    at require.resolve (node:internal/modules/helpers:163:19)
    at jitiResolve (/Users/myusername/.npm/_npx/167ca1f116d365e6/node_modules/jiti/dist/jiti.cjs:1:148703)
    at jitiRequire (/Users/myusername/.npm/_npx/167ca1f116d365e6/node_modules/jiti/dist/jiti.cjs:1:150290)
    at import (/Users/myusername/.npm/_npx/167ca1f116d365e6/node_modules/jiti/dist/jiti.cjs:1:158307)
    at /Users/myusername/repos/betterauth-nextjs-prisma/src/lib/prisma.ts:1:217
    at eval_evalModule (/Users/myusername/.npm/_npx/167ca1f116d365e6/node_modules/jiti/dist/jiti.cjs:1:155533)
    at jitiRequire (/Users/myusername/.npm/_npx/167ca1f116d365e6/node_modules/jiti/dist/jiti.cjs:1:150967)
    at import (/Users/myusername/.npm/_npx/167ca1f116d365e6/node_modules/jiti/dist/jiti.cjs:1:158307)
    at /Users/myusername/repos/betterauth-nextjs-prisma/src/lib/auth.ts:3:45 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/Users/myusername/repos/betterauth-nextjs-prisma/src/lib/prisma.ts' ]

I see the the path in /src/lib/prisma.ts is not correct, so I appended the "src" section.

The final import is like this:

import { PrismaClient } from "@/src/generated/prisma/client";

So I changed the path so that other people won't trip over it again. Cheers! :)

Summary by CodeRabbit

  • Documentation
    • Corrected import path references in the BetterAuth Next.js guide to align with the current project structure; no functional or behavioral changes.

✏️ Tip: You can customize this high-level summary in your review settings.

shrekuu avatar Dec 06 '25 07:12 shrekuu

Walkthrough

A single documentation file had two import path corrections: the PrismaClient import path changed from @/generated/prisma/client to @/src/generated/prisma/client, and an auth import path changed from @/lib/auth to @/src/lib/auth.

Changes

Cohort / File(s) Summary
Import path corrections
content/800-guides/230-betterauth-nextjs.mdx
Updated two import paths inside the guide: PrismaClient import from @/generated/prisma/client β†’ @/src/generated/prisma/client, and auth import from @/lib/auth β†’ @/src/lib/auth.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Small, local text/code-sample edits only; no behavioral changes.
  • Check code samples render correctly and imported paths match repository layout.

Possibly related PRs

  • prisma/docs#7215 β€” Adjusts Prisma client import paths to the new src/... location pattern (closely related import-path edits).
  • prisma/docs#7073 β€” Modifies Prisma client and lib import paths across docs (similar refactor of import targets).
  • prisma/docs#7116 β€” Updates references to generated Prisma client import locations (overlaps on the same import targets).

Pre-merge checks

βœ… Passed checks (3 passed)
Check name Status Explanation
Description Check βœ… Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check βœ… Passed The title accurately reflects the primary change: updating import paths for the Prisma client to match the project structure by including the 'src' segment.
Docstring Coverage βœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

πŸ“œ Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 9aea3698a01b0c0fac70ba4f4ff1cbd2cc3afb95 and 9fff1e1ecefa0138954f1c5a4f2581fa0400af03.

πŸ“’ Files selected for processing (1)
  • content/800-guides/230-betterauth-nextjs.mdx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • content/800-guides/230-betterauth-nextjs.mdx

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Dec 06 '25 07:12 coderabbitai[bot]