Prisma-client-js: Queries and mutations stuck (runs forever?) if log option is ['query', 'warn']

Created on 4 Jun 2020  路  2Comments  路  Source: prisma/prisma-client-js

Bug description


When the log option for the Prisma client is set to ['query', 'warn'] i.e without the info option or ['warn'] i.e without query and info, all queries and mutations get stuck at the first call to the client. Using the three options or any of the other two alone or together works fine but the warn option seems to only work when info is also set.
Is this a bug or the expected behavior? If it is the expected behavior, can we make this clear in the docs?
`

How to reproduce

Steps to reproduce the behavior:

  1. Setup a minimal server that uses the Prisma client (I use Apollo Server)
  2. Instantiate the client with the log option set to ['query', 'warn'] or ['warn']
  3. Create some resolvers
  4. Run the server and make queries to the server
  5. Observe the query loading endlessly

Expected behavior


['query', 'warn'] and ['warn'] log options should work without the info option

Prisma information

Environment & setup

  • OS: Mac OS
  • Database: PostgreSQL
  • Prisma version: 2.0.0-beta.6 and 2.0.0-beta.7
  • Node.js version: 12.17.0
bu2-confirmed kinregression tectypescript

Most helpful comment

Thanks a lot for reporting 馃檹
This issue is fixed in the latest alpha version of @prisma/cli.
You can try it out with npm i -g @prisma/cli@alpha.

In case it鈥檚 not fixed for you - please let us know and we鈥檒l reopen this issue!

All 2 comments

I can confirm this bug. We need to address this pretty quickly.

Reproduction:

  1. Use https://github.com/prisma/prisma-examples/tree/master/typescript/graphql-apollo-server to get a server with Prisma Client.
  2. Pass log: ['query', 'warn'], to the Prisma client constructor in src/context.ts
  3. Start the server using yarn dev and try running a query, it will hang like so:
    image

Debug trace:

yarn run v1.22.4
warning package.json: No license field
$ ts-node-dev --no-notify --respawn --transpileOnly src/server
Using ts-node version 8.10.1, typescript version 3.9.3
  prisma-client Client Version 2.0.0-beta.8 +0ms
  prisma-client Engine Version ff6959d77f8880ec037ed8201fff4a92f3aabaa0 +2ms
  prisma-client {
  prisma-client   engineConfig: {
  prisma-client     cwd: '/Users/harshit/code/reproductions/issue-client-714/graphql-apollo-server/prisma',
  prisma-client     debug: false,
  prisma-client     datamodelPath: '/Users/harshit/code/reproductions/issue-client-714/graphql-apollo-server/node_modules/.prisma/client/schema.prisma',
  prisma-client     prismaPath: undefined,
  prisma-client     generator: {
  prisma-client       name: 'client',
  prisma-client       provider: 'prisma-client-js',
  prisma-client       output: '/Users/harshit/code/reproductions/issue-client-714/graphql-apollo-server/node_modules/@prisma/client',
  prisma-client       binaryTargets: [],
  prisma-client       config: {}
  prisma-client     },
  prisma-client     showColors: false,
  prisma-client     logLevel: 'warn',
  prisma-client     logQueries: true,
  prisma-client     flags: [],
  prisma-client     clientVersion: '2.0.0-beta.8'
  prisma-client   }
  prisma-client } +0ms
  express:application set "x-powered-by" to true +0ms
  express:application set "etag" to 'weak' +0ms
  express:application set "etag fn" to [Function: generateETag] +0ms
  express:application set "env" to 'development' +0ms
  express:application set "query parser" to 'extended' +1ms
  express:application set "query parser fn" to [Function: parseExtendedQueryString] +0ms
  express:application set "subdomain offset" to 2 +0ms
  express:application set "trust proxy" to false +0ms
  express:application set "trust proxy fn" to [Function: trustNone] +0ms
  express:application booting in development mode +0ms
  express:application set "view" to [Function: View] +0ms
  express:application set "views" to '/Users/harshit/code/reproductions/issue-client-714/graphql-apollo-server/views' +0ms
  express:application set "jsonp callback name" to 'callback' +0ms
  express:application set "x-powered-by" to false +0ms
  express:router use '/' <anonymous> +1ms
  express:router:layer new '/' +0ms
  express:router use '/.well-known/apollo/server-health' <anonymous> +0ms
  express:router:layer new '/.well-known/apollo/server-health' +0ms
  express:router use '/' corsMiddleware +1ms
  express:router:layer new '/' +0ms
  express:router use '/' jsonParser +0ms
  express:router:layer new '/' +0ms
  express:router use '/' <anonymous> +0ms
  express:router:layer new '/' +0ms
  express:router use '/' <anonymous> +1ms
  express:router:layer new '/' +0ms
  express:router use '/' query +0ms
  express:router:layer new '/' +0ms
  express:router use '/' expressInit +0ms
  express:router:layer new '/' +0ms
  express:router use '/' router +0ms
  express:router:layer new '/' +0ms
馃殌 Server ready at: http://localhost:4000
猸愶笍 See sample queries: http://pris.ly/e/ts/graphql-apollo-server#using-the-graphql-api
  express:router dispatching POST / +4s
  express:router query  : / +2ms
  express:router expressInit  : / +1ms
  express:router router  : / +1ms
  express:router dispatching POST / +0ms
  express:router <anonymous>  : / +0ms
  express:router corsMiddleware  : / +1ms
  express:router jsonParser  : / +0ms
  body-parser:json content-type "application/json" +1ms
  body-parser:json content-encoding "identity" +1ms
  body-parser:json read body +0ms
  body-parser:json parse body +12ms
  body-parser:json parse json +0ms
  express:router <anonymous>  : / +0ms
  express:router <anonymous>  : / +0ms
  prisma-client Prisma Client call: +4s
  prisma-client prisma.post.findMany({
  prisma-client   where: {
  prisma-client     published: true
  prisma-client   }
  prisma-client }) +1ms
  prisma-client Generated request: +1ms
  prisma-client query {
  prisma-client   findManyPost(where: {
  prisma-client     published: true
  prisma-client   }) {
  prisma-client     id
  prisma-client     authorId
  prisma-client     content
  prisma-client     published
  prisma-client     title
  prisma-client   }
  prisma-client }
  prisma-client  +0ms
  engine {
  engine   cwd: '/Users/harshit/code/reproductions/issue-client-714/graphql-apollo-server/prisma'
  engine } +0ms
  engine {
  engine   dotPrismaPath: '/Users/harshit/code/reproductions/issue-client-714/graphql-apollo-server/node_modules/.prisma/client/query-engine-darwin'
  engine } +0ms
  plusX Execution permissions of /Users/harshit/code/reproductions/issue-client-714/graphql-apollo-server/node_modules/.prisma/client/query-engine-darwin are fine +0ms
  engine { flags: [ '--enable-raw-queries' ] } +1ms
  engine stderr Printing to stderr for debugging +41ms
  engine stderr Listening on 127.0.0.1:54563 +0ms

Thanks a lot for reporting 馃檹
This issue is fixed in the latest alpha version of @prisma/cli.
You can try it out with npm i -g @prisma/cli@alpha.

In case it鈥檚 not fixed for you - please let us know and we鈥檒l reopen this issue!

Was this page helpful?
0 / 5 - 0 ratings