Skip to content

Commit

Permalink
fix: add custom inspect to work around a Prisma issue that causes con…
Browse files Browse the repository at this point in the history
…sole to hang (#9623)

The related Prisma issue: prisma/prisma#18292

It basically causes all kinds of Node REPLs that use PrismaClient to
hang when users type the variable name that holds the client. Adding a
workaround as suggested in the Prisma thread.

Fixes #8817
  • Loading branch information
ymc9 authored and jtoar committed Dec 5, 2023
1 parent c625d2e commit 296f374
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/cli/src/commands/consoleHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const paths = getPaths()

const loadPrismaClient = (replContext) => {
const { db } = require(path.join(paths.api.lib, 'db'))
// workaround for Prisma issue: https://github.com/prisma/prisma/issues/18292
db[Symbol.for('nodejs.util.inspect.custom')] = 'PrismaClient'
replContext.db = db
}

Expand Down

0 comments on commit 296f374

Please sign in to comment.