question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prisma hangs when javascript is minified

See original GitHub issue

Bug description

We noticed that if code is bundled and prisma throws a constraint error (e.g. duplicate key on insert, or invalid foreign key) the execution hangs.

How to reproduce

Implement code that would cause prisma to throw a constraint error. If executed, the exception is properly raise. Now bundle the code with a bundler (e.g. esbuild). Execute again and notice that the application hangs.

Expected behavior

The bundled code should throw the expected exception

Prisma information

The issue seems to be unrelated to the schema. Just need a couple of tables with a FK constraint.

Environment & setup

  • OS: AWS Lambda (Amazon Linux 2)
  • Database: PostgreSQL
  • Node.js version: 14

Prisma Version

prisma                  : 3.10.0
@prisma/client          : 3.10.0
Current platform        : darwin
Query Engine (Node-API) : libquery-engine 73e60b76d394f8d37d8ebd1f8918c79029f0db86 (at node_modules/@prisma/engines/libquery_engine-darwin.dylib.node)
Migration Engine        : migration-engine-cli 73e60b76d394f8d37d8ebd1f8918c79029f0db86 (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine    : introspection-core 73e60b76d394f8d37d8ebd1f8918c79029f0db86 (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary           : prisma-fmt 73e60b76d394f8d37d8ebd1f8918c79029f0db86 (at node_modules/@prisma/engines/prisma-fmt-darwin)
Default Engines Hash    : 73e60b76d394f8d37d8ebd1f8918c79029f0db86
Studio                  : 0.458.0

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
mdesousacommented, Mar 18, 2022

hi @janpio , please take a look at this repository: https://github.com/holasivo/prisma-12355 in testing with this simple repo, the code actually works… but it is very slow when minified i’m wondering now if the issue is related to the exception including the source code. trying to print that may be a lot slower for minified code (there are no line breaks, the file is larger, etc.). our application has a lot more code getting minified and it times out after 30 seconds. i’d also recommend to avoid printing source code in the exception message for security reasons… the stack trace already provides the code context. thanks!

1reaction
millspcommented, Jun 2, 2022

Because we need to find the schema and the engine in order to run the queries, we have logic to find that but it is suboptimal.

Read more comments on GitHub >

github_iconTop Results From Across the Web

System requirements - Prisma
TypeScript is only required for TypeScript users. When using Yarn 1, 1.19.2 is the minimum version compatible with Prisma Client. See also: Supported...
Read more >
prisma - NPM Package Overview - Socket.dev
Prisma is an open-source database toolkit. It includes a JavaScript/TypeScript ORM for Node.js, migrations and a modern GUI to view and edit ...
Read more >
@prisma/client v4.8.0 Bundlephobia
Size of @prisma/client v4.8.0 is 233.0 B (minified), and 171.0 B when compressed using GZIP. Bundlephobia helps you find the performance impact of...
Read more >
Recently Active 'prisma' Questions - Stack Overflow
prisma db push hangs and then returns Error: P1017 Server has closed the ... Error: Minified React error #321; when deploying next.js project...
Read more >
Building a SSR framework from Scratch - zach.codes
Learn how to build a server side rendering framework like NextJS or SvelteKit. Using ReactJS, Vite, and Prisma.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found