Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ node_modules
/prisma/data.db
/prisma/data.db-journal
/tests/prisma
/prisma/generated

/test-results/
/playwright-report/
Expand Down
2 changes: 1 addition & 1 deletion app/routes/users/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { searchUsers } from '@prisma/client/sql'
import { searchUsers } from '../../../prisma/generated/sql'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's put this in the imports config in package.json so we don't need to worry about ../../...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ✅

import { Img } from 'openimg/react'
import { redirect, Link } from 'react-router'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
Expand Down
2 changes: 1 addition & 1 deletion app/utils/auth.server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import crypto from 'node:crypto'
import { type Connection, type Password, type User } from '@prisma/client'
import { type Connection, type Password, type User } from '../../prisma/generated/client'
import bcrypt from 'bcryptjs'
import { redirect } from 'react-router'
import { Authenticator } from 'remix-auth'
Expand Down
7 changes: 5 additions & 2 deletions app/utils/db.server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import 'dotenv/config'
import { styleText } from 'node:util'
import { remember } from '@epic-web/remember'
// Changed import due to issue: https://github.com/remix-run/react-router/pull/12644
import { PrismaClient } from '@prisma/client/index.js'
import { PrismaClient } from '../../prisma/generated/client'
import { PrismaBetterSQLite3 } from "@prisma/adapter-better-sqlite3"

export const prisma = remember('prisma', () => {
// NOTE: if you change anything in this function you'll need to restart
Expand All @@ -10,7 +11,9 @@ export const prisma = remember('prisma', () => {
// Feel free to change this log threshold to something that makes sense for you
const logThreshold = 20

const adapter = new PrismaBetterSQLite3({ url: process.env.DATABASE_URL })
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Prisma Adapter: Mismatched Connection Type

The PrismaBetterSQLite3 adapter is initialized with { url: process.env.DATABASE_URL }, but this adapter requires a better-sqlite3 Database instance, not a URL string. The adapter expects an already-instantiated database connection from the better-sqlite3 package. This will cause a runtime error when the application tries to connect to the database.

Fix in Cursor Fix in Web

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, my friend cursor its fine :)

const client = new PrismaClient({
adapter,
log: [
{ level: 'query', emit: 'event' },
{ level: 'error', emit: 'stdout' },
Expand Down
Loading