From 296f374f78cb8aca1f31b69500cf952c7af081e1 Mon Sep 17 00:00:00 2001 From: Yiming Date: Mon, 4 Dec 2023 20:46:31 -0800 Subject: [PATCH] fix: add custom inspect to work around a Prisma issue that causes console to hang (#9623) The related Prisma issue: https://github.com/prisma/prisma/issues/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 --- packages/cli/src/commands/consoleHandler.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/cli/src/commands/consoleHandler.js b/packages/cli/src/commands/consoleHandler.js index 084d9261965a..adeb480e734d 100644 --- a/packages/cli/src/commands/consoleHandler.js +++ b/packages/cli/src/commands/consoleHandler.js @@ -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 }