prisma: Connections from repl.it repls randomly failing with various errors

Bug description

Prisma connections from a lot of my repl.it repls randomly fail with various errors due to unknown reasons.

Here are the errors I’ve seen (Descending order of frequency):

[ERROR] : 
Invalid `prisma.workspace.findUnique()` invocation:
  Can't reach database server at `ec2-50-19-32-202.compute-1.amazonaws.com`:`5432`
Please make sure your database server is running at `ec2-50-19-32-202.compute-1.amazonaws.com`:`5432`.
Invalid `prisma.workspace.findUnique()` invocation:
  Error creating a database connection. (Operation timed out (mobc timeout))
    at new AuthorizationError (/home/runner/InfoBot-old-2/node_modules/@slack/oauth/dist/errors.js:71:28)
    at InstallProvider.<anonymous> (/home/runner/InfoBot-old-2/node_modules/@slack/oauth/dist/index.js:158:31)
    at step (/home/runner/InfoBot-old-2/node_modules/@slack/oauth/dist/index.js:44:23)
    at Object.throw (/home/runner/InfoBot-old-2/node_modules/@slack/oauth/dist/index.js:25:53)
    at rejected (/home/runner/InfoBot-old-2/node_modules/@slack/oauth/dist/index.js:17:65)
Invalid `prisma.channel.upsert()` invocation:
  Timed out fetching a new connection from the pool. Please consider reducing the number of requests or increasing the `connection_limit` parameter (https://www.prisma.io/docs/concepts/components/prisma-client/connection-management#connection-pool). Current limit: 5, amount of connections currently in use: 0.
    at Object.asCodedError (/home/runner/HackClubKarma/node_modules/@slack/bolt/dist/errors.js:23:12)
    at App.handleError (/home/runner/HackClubKarma/node_modules/@slack/bolt/dist/App.js:442:43)
    at App.processEvent (/home/runner/HackClubKarma/node_modules/@slack/bolt/dist/App.js:435:25)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Note

I’ve already spoken to folks at repl.it and @nikolasburk – here’s some context:

Screenshot of message from @nikolasburk with text: "All right, thanks for sharing! I've just checked back with our engineers and I think the best way to tackle this is to create an issue so that someone from the engineering team can look into this properly. It seems like nobody really has experience with repl.it yet but we definitely want to make sure that it's properly supported! Ideally we even get to a point where we can say Prisma reliably works on repl.it and can add it to our e2e tests. Does that sound ok to you?"

How to reproduce

Not always reproducible. Occurs randomly and can only fixed by creating a fresh copy of (forking) the repl

Affected repls:

Expected behavior

  • Prisma can connect to the database (since it works locally and via psql)

Prisma information

datasource db {
    url      = env("DATABASE_URL")
    provider = "postgresql"
}

generator client {
    provider = "prisma-client-js"
}

model Workspace {
    id           String @id
    installation String
}

Environment & setup

  • OS: Linux
  • Database: PostgreSQL
  • Node.js version: v12.16.1
  • Prisma version: 2.14.0

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

If you have the time, it would be very helpful if you could try to explicitly call the disconnect in your code. This way we can ensure there are no dangling connections and see if the problem persists. A pattern for doing that is detailed here: https://www.prisma.io/docs/concepts/components/prisma-client/connection-management#calling-disconnect-explicitly

Hi, I’ll surely try that but I’m not sure how long it will take to know if the problem is solved, since the issue randomly reproduces