Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

later imported prisma client class will emit logs unexpectedly when using multiple clients #2812

Closed
EqualMa opened this issue Jun 20, 2020 · 3 comments

Comments

@EqualMa
Copy link

EqualMa commented Jun 20, 2020

Bug description

When using multiple prisma clients as described in this comment,

import { PrismaClient as PrismaClient1 } from '../prisma/client1'
import { PrismaClient as PrismaClient2 } from '../prisma/client2'

const client1 = new PrismaClient1()
const client2 = new PrismaClient2()

it will output lots of logs when
creating new instance for the later imported client class.

For example, when only creating new instance, the following logs are output:

  prisma-client Client Version 2.0.0 +0ms
  prisma-client Engine Version de2bc1cbdb5561ad73d2f08463fa2eec48993f56 +2ms
  prisma-client {
  prisma-client   engineConfig: {
  prisma-client     cwd: '/workspace/prisma-multi-conn/prisma',
  prisma-client     debug: false,
  prisma-client     datamodelPath: '/workspace/prisma-multi-conn/generated/client2/schema.prisma',
  prisma-client     prismaPath: undefined,
  prisma-client     generator: {
  prisma-client       name: 'client',
  prisma-client       provider: 'prisma-client-js',
  prisma-client       output: '/workspace/prisma-multi-conn/generated/client2',
  prisma-client       binaryTargets: [],
  prisma-client       config: {},
  prisma-client       isCustomOutput: true
  prisma-client     },
  prisma-client     showColors: false,
  prisma-client     logLevel: undefined,
  prisma-client     logQueries: undefined,
  prisma-client     flags: [],
  prisma-client     clientVersion: '2.0.0'
  prisma-client   }
  prisma-client } +0ms

How to reproduce

clone this repo: https://github.com/EqualMa/prisma-multi-conn
and then:

npm install
npm run gen 
npx ts-node script.ts

DO NOT specify DEBUG="*" because with this env var all clients will emit logs as expected.

Expected behavior

No logs should be emitted

Prisma information

can be seen in the repo.

Environment & setup

  • OS: Ubuntu 20.04
  • Database: MySQL (my own project where I found this issue) and SQLite (the repro repo)
  • Prisma version: 2.0.0
  • Node.js version: v12.18.1
@beeplin
Copy link

beeplin commented Jun 21, 2020

got the same issue in postgres

@pantharshit00
Copy link
Contributor

Looks like this is related to #2787 and might be closed a a duplicate.

#2787 is fixed in dev and will be released in 2.1.0 tomorrow.

After upgrading to dev, I can't reproduce this:
image

To install the dev version now, run:

npm install @prisma/cli@dev @prisma/client@dev

After that regenerate the client.

@pantharshit00
Copy link
Contributor

I am actually going to close this as a duplicate of #2787. Feel feel to comment here if above doesn't fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants