Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

Queries and mutations stuck (runs forever?) if log option is ['query', 'warn'] #714

Closed
Veraclins opened this issue Jun 3, 2020 · 2 comments
Labels
bug/2-confirmed We have confirmed that this is a bug. kind/regression A reported bug in functionality that used to work before. tech/typescript Issue for tech TypeScript.
Milestone

Comments

@Veraclins
Copy link

Veraclins commented Jun 3, 2020

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
@pantharshit00
Copy link
Contributor

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

@pantharshit00 pantharshit00 added bug/2-confirmed We have confirmed that this is a bug. kind/regression A reported bug in functionality that used to work before. labels Jun 5, 2020
@Jolg42 Jolg42 added this to the Beta 9 milestone Jun 5, 2020
@Jolg42 Jolg42 added the tech/typescript Issue for tech TypeScript. label Jun 5, 2020
timsuchanek added a commit to prisma/prisma that referenced this issue Jun 5, 2020
@timsuchanek
Copy link
Contributor

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’s not fixed for you - please let us know and we’ll reopen this issue!

@janpio janpio modified the milestones: Beta 9, New Beta 9 Jun 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug/2-confirmed We have confirmed that this is a bug. kind/regression A reported bug in functionality that used to work before. tech/typescript Issue for tech TypeScript.
Projects
None yet
Development

No branches or pull requests

5 participants