Prisma-client-js: Started http server

Created on 27 Jul 2020  路  9Comments  路  Source: prisma/prisma-client-js

Hi Prisma Team! My Prisma Client just crashed. This is the report:

Versions

| Name | Version |
|----------|--------------------|
| Node | v10.16.3 |
| OS | rhel-openssl-1.0.x |
| Prisma | 2.1.3 |

Description

Started http server

Logs

 }  +3s
  prisma-client { engineConfig:
  prisma-client    { cwd: '/var/www/up-osmp/prisma',
  prisma-client      enableDebugLogs: false,
  prisma-client      enableEngineDebugMode: undefined,
  prisma-client      datamodelPath: '/var/www/up-osmp/node_modules/.prisma/client/schema.prisma',
  prisma-client      prismaPath: undefined,
  prisma-client      engineEndpoint: undefined,
  prisma-client      generator:
  prisma-client       { name: 'client',
  prisma-client         provider: 'prisma-client-js',
  prisma-client         output: '/var/www/up-osmp/node_modules/@prisma/client',
  prisma-client         binaryTargets: [],
  prisma-client         previewFeatures: [],
  prisma-client         config: {} },
  prisma-client      showColors: false,
  prisma-client      logLevel: undefined,
  prisma-client      logQueries: undefined,
  prisma-client      flags: [],
  prisma-client      clientVersion: '2.1.3',
  prisma-client      enableExperimental: [] } }  +387ms
  prisma-client { engineConfig:
  prisma-client    { cwd: '/var/www/up-osmp/prisma',
  prisma-client      enableDebugLogs: false,
  prisma-client      enableEngineDebugMode: undefined,
  prisma-client      datamodelPath: '/var/www/up-osmp/node_modules/.prisma/client/schema.prisma',
  prisma-client      prismaPath: undefined,
  prisma-client      engineEndpoint: undefined,
  prisma-client      generator:
  prisma-client       { name: 'client',
  prisma-client         provider: 'prisma-client-js',
  prisma-client         output: '/var/www/up-osmp/node_modules/@prisma/client',
  prisma-client         binaryTargets: [],
  prisma-client         previewFeatures: [],
  prisma-client         config: {} },
  prisma-client      showColors: false,
  prisma-client      logLevel: undefined,
  prisma-client      logQueries: undefined,
  prisma-client      flags: [],
  prisma-client      clientVersion: '2.1.3',
  prisma-client      enableExperimental: [] } }  +891ms
  prisma-client { engineConfig:
  prisma-client    { cwd: '/var/www/up-osmp/prisma',
  prisma-client      enableDebugLogs: false,
  prisma-client      enableEngineDebugMode: undefined,
  prisma-client      datamodelPath: '/var/www/up-osmp/node_modules/.prisma/client/schema.prisma',
  prisma-client      prismaPath: undefined,
  prisma-client      engineEndpoint: undefined,
  prisma-client      generator:
  prisma-client       { name: 'client',
  prisma-client         provider: 'prisma-client-js',
  prisma-client         output: '/var/www/up-osmp/node_modules/@prisma/client',
  prisma-client         binaryTargets: [],
  prisma-client         previewFeatures: [],
  prisma-client         config: {} },
  prisma-client      showColors: false,
  prisma-client      logLevel: undefined,
  prisma-client      logQueries: undefined,
  prisma-client      flags: [],
  prisma-client      clientVersion: '2.1.3',
  prisma-client      enableExperimental: [] } }  +122ms
  prisma-client Prisma Client call:  +348ms
  prisma-client prisma.users.deleteMany({
  prisma-client   where: {
  prisma-client     phone: {
  prisma-client       equals: '+79000110001'
  prisma-client     }
  prisma-client   }
  prisma-client })  +4ms
  prisma-client Generated request:  +0ms
  prisma-client mutation {
  prisma-client   deleteManyusers(where: {
  prisma-client     phone: "+79000110001"
  prisma-client   }) {
  prisma-client     count
  prisma-client   }
  prisma-client }
  prisma-client   +0ms
  prisma-client Prisma Client call:  +2ms
  prisma-client prisma.users.deleteMany({
  prisma-client   where: {
  prisma-client     phone: {
  prisma-client       equals: '+79000110002'
  prisma-client     }
  prisma-client   }
  prisma-client })  +1ms
  prisma-client Generated request:  +0ms
  prisma-client mutation {
  prisma-client   deleteManyusers(where: {
  prisma-client     phone: "+79000110002"
  prisma-client   }) {
  prisma-client     count
  prisma-client   }
  prisma-client }
  prisma-client   +0ms
  prisma-client Prisma Client call:  +1ms
  prisma-client prisma.users.deleteMany({
  prisma-client   where: {
  prisma-client     phone: {
  prisma-client       equals: '+79000110003'
  prisma-client     }
  prisma-client   }
  prisma-client })  +0ms
  prisma-client Generated request:  +0ms
  prisma-client mutation {
  prisma-client   deleteManyusers(where: {
  prisma-client     phone: "+79000110003"
  prisma-client   }) {
  prisma-client     count
  prisma-client   }
  prisma-client }
  prisma-client   +0ms
  plusX Execution permissions of /var/www/up-osmp/node_modules/.prisma/client/query-engine-rhel-openssl-1.0.x are fine  +0ms
  prisma-client Client Version 2.1.3  +234ms
  prisma-client Engine Version e11114fa1ea826f9e7b4fa1ced34e78892fe8e0e  +0ms
bu0-needs-info kinbug statuneeds-action teasupport-engineering basic reporting issue

All 9 comments

@Kalinkin92 Thanks, can you please share your schema and the Prisma client query that fails? A minimal reproduction would help up triage this quickly.

I'm having the same issue, the error only ever occurs when I'm using prisma.disconnect() (with Next.js in dev mode), w/o the error will never show up.

Versions

| Name | Version |
|----------|--------------------|
| Node | v12.18.2 |
| OS | darwin |
| Prisma | 2.3.0 |

Description

Started http server

Logs

  prisma-client {
  prisma-client   engineConfig: {
  prisma-client     cwd: '/Users/redacted/Projects/Personal/redacted/prisma',
  prisma-client     enableDebugLogs: false,
  prisma-client     enableEngineDebugMode: undefined,
  prisma-client     datamodelPath: '/Users/redacted/Projects/Personal/redacted/node_modules/.prisma/client/schema.prisma',
  prisma-client     prismaPath: undefined,
  prisma-client     engineEndpoint: undefined,
  prisma-client     generator: {
  prisma-client       name: 'client',
  prisma-client       provider: 'prisma-client-js',
  prisma-client       output: '/Users/redacted/Projects/Personal/redacted/node_modules/@prisma/client',
  prisma-client       binaryTargets: [],
  prisma-client       previewFeatures: [Array],
  prisma-client       config: {}
  prisma-client     },
  prisma-client     showColors: false,
  prisma-client     logLevel: undefined,
  prisma-client     logQueries: undefined,
  prisma-client     flags: [],
  prisma-client     clientVersion: '2.3.0',
  prisma-client     enableExperimental: [ 'aggregations', 'aggregations' ]
  prisma-client   }
  prisma-client }  +0ms
  plusX Execution permissions of /Users/redacted/Projects/Personal/redacted/node_modules/.prisma/client/query-engine-darwin are fine  +0ms
  prisma-client Client Version 2.3.0  +94ms
  prisma-client Engine Version e11114fa1ea826f9e7b4fa1ced34e78892fe8e0e  +0ms

I'm having the same issue, the error only ever occurs when I'm using prisma.disconnect() (with Next.js in dev mode), w/o the error will never show up.

Versions

Name Version
Node v12.18.2
OS darwin
Prisma 2.3.0

Description

Started http server

Logs

  prisma-client {
  prisma-client   engineConfig: {
  prisma-client     cwd: '/Users/redacted/Projects/Personal/redacted/prisma',
  prisma-client     enableDebugLogs: false,
  prisma-client     enableEngineDebugMode: undefined,
  prisma-client     datamodelPath: '/Users/redacted/Projects/Personal/redacted/node_modules/.prisma/client/schema.prisma',
  prisma-client     prismaPath: undefined,
  prisma-client     engineEndpoint: undefined,
  prisma-client     generator: {
  prisma-client       name: 'client',
  prisma-client       provider: 'prisma-client-js',
  prisma-client       output: '/Users/redacted/Projects/Personal/redacted/node_modules/@prisma/client',
  prisma-client       binaryTargets: [],
  prisma-client       previewFeatures: [Array],
  prisma-client       config: {}
  prisma-client     },
  prisma-client     showColors: false,
  prisma-client     logLevel: undefined,
  prisma-client     logQueries: undefined,
  prisma-client     flags: [],
  prisma-client     clientVersion: '2.3.0',
  prisma-client     enableExperimental: [ 'aggregations', 'aggregations' ]
  prisma-client   }
  prisma-client }  +0ms
  plusX Execution permissions of /Users/redacted/Projects/Personal/redacted/node_modules/.prisma/client/query-engine-darwin are fine  +0ms
  prisma-client Client Version 2.3.0  +94ms
  prisma-client Engine Version e11114fa1ea826f9e7b4fa1ced34e78892fe8e0e  +0ms

not sure about the issue, but you don't need disconnect prisma on nextjs in dev mode. you can use the same instance all the time:

import { PrismaClient } from "@prisma/client"

let prisma: PrismaClient

declare global {
  namespace NodeJS {
    interface Global {
      prisma: PrismaClient
    }
  }
}

if (process.env.NODE_ENV === "production") {
  prisma = new PrismaClient()
} else {
  if (!global.prisma) {
    global.prisma = new PrismaClient()
  }

  prisma = global.prisma
}

export default prisma

Hey @kldzj Did you issue get fixed after doing what @macrozone suggested?

Hey @pantharshit00, indeed this solved my problem. But I still think that the issue itself persists, because Prisma should've worked even after closing the connection, as the docs state that the client will connect itself lazily.

@kldzj If you explicity call disconnect() it won't connect again.

What the docs meant is you don't need to call prisma.connect in order to establish a connection as client will do that lazily. Client will also reconnect if it crashes. Reconnecting after explicitly disconnecting is not intended.

Makes sense, thank you very much for clarifying @pantharshit00

But what about situations when we actually we do need to disconnect?

According to the docs:
"When deploying your application as a long-running process or when running a Node.js script that uses Prisma Client, it's recommended to always explicitly call prisma.$disconnect() in your code even when an exception is thrown as shown below. Otherwise, the Node.js process will not exit automatically."

@alonbilu That is for exiting the process. If you want to connect again, you can just instantiate the Prisma Client again using new PrismaClient

Was this page helpful?
0 / 5 - 0 ratings