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 connection not closing in Playwright test runner

See original GitHub issue

Bug description

Hello, Prisma team, thanks for your amazing work.

We use Playwright for running e2e tests against our web applications at my company. We are already using Prisma on the backend and would like to use it also for seeding (and tearing down) the data that is required for running the tests (creating a test user, deleting a post after creating it, etc).

So far Prisma works well for this purpose, speeding up my workflow a lot. However, some of the time, the playwright process gets stuck and It never exits. I suspect that it is related to the Prisma client connection because I see these logs over and over when the tests have been completed (using DEBUG=*):

2022-06-06_12-32

This goes on forever and I have to manually Ctrl+C, which is not ideal for a CI environment

How to reproduce

So far I have not reached a reliable reproduction. For every 5 tests that I run, 3 of them get stuck and never exit.

I’d like to know if you can give me any hints at what may be causing this problem or how to properly manage my connections. It might be useful to consider that Playwright runs tests in parallel using worker processes.

Expected behavior

I expect the Playwright process to exit immediately after the tests have completed (either successful or unsuccessfully)

Prisma information

Environment & setup

  • OS: KDE Neon 5.24
  • Database: MySQL 8
  • Node.js version: 14.17.4

Prisma Version

prisma                  : 3.13.0
@prisma/client          : 3.13.0
Current platform        : debian-openssl-1.1.x
Query Engine (Node-API) : libquery-engine efdf9b1183dddfd4258cd181a72125755215ab7b (at node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Migration Engine        : migration-engine-cli efdf9b1183dddfd4258cd181a72125755215ab7b (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine    : introspection-core efdf9b1183dddfd4258cd181a72125755215ab7b (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary           : prisma-fmt efdf9b1183dddfd4258cd181a72125755215ab7b (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash    : efdf9b1183dddfd4258cd181a72125755215ab7b
Studio                  : 0.459.0
Preview Features        : fullTextSearch, fullTextIndex

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
arvindellcommented, Sep 23, 2022

How do we get to a reproduction of this @arvindell? Right now we are just guessing, but of course we would love to experience this ourselves so we can actually fix it. Thanks.

Hi! Since I created this issue this is not a problem anymore. The tests are closing the connection correctly now. I’m guessing it was a Playwright bug that got fixed

Thanks!

0reactions
janpiocommented, Sep 23, 2022

Awesome, thanks for the update!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Connecting and disconnecting (Concepts) - Prisma
This page explains how database connections are handled with Prisma Client and how to manually connect and disconnect your database.
Read more >
Jest and NestJs how how to close the prisma connections
Jest did not exit one second after the test run has completed. This usually means that there are asynchronous operations that weren't stopped...
Read more >
Prisma - Supabase
This guide explains how to quickly connect the Postgres database provided by Supabase to a Prisma project. Prisma is an open source next-generation...
Read more >
setting up and tearing down a database with Playwright - Reddit
Hi, i wondered if anyone has any experience using playwright and needing to connect to a test database. We use prisma to interact...
Read more >
Seeding test databases in 2021 - best practices - Synth
Prisma is an ORM, an object relational mapping. It is a powerful framework that lets you specify your data model using a database...
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