Graphql-code-generator: No longer reporting in console location of documents with issues

Created on 13 Jun 2020  路  2Comments  路  Source: dotansimha/graphql-code-generator

Describe the bug
When a document has an issue, eg. querying a field that doesn't exist, the tool would previously report the location of the offending file. Now it just reports the error, and I have no idea which document the error is in.

To Reproduce
Run yarn generate in the reproduction repo in sandbox for this issue.

  1. My GraphQL schema:
type Query {
    user(id: ID!): User!
}

type User {
    id: ID!
    username: String!
    email: String!
}
  1. My GraphQL operations:
query user {
    user(id: 1) {
        id
        username
        email
        i_do_not_exist
    }
}
  1. My codegen.yml config file:
schema: schema.graphql
documents: document.graphql
generates:
  types.ts:
    plugins:
      - typescript
      - typescript-operations

Expected behavior
The errors shown in the console when running yarn generate in the reproduction repo in sandbox for this issue should inidcate wich file is responsible for the error.

Environment:

  • OS: Ubuntu 18.04 LTS
  • @graphql-codegen/*: 1.15.3
  • NodeJS: v13.7.0
bug core waiting-for-release

Most helpful comment

Fixed in v1.15.4

All 2 comments

@ardatan It seems like an issue with graphql-tools. Can you please take a look?
In the example @aryzing shared, it looks like the issue is coming from the checkValidationErrors - this method swallows the error details. In the original GraphQLError it seems like it exists:

[
  Error [GraphQLDocumentError]: Cannot query field "i_do_not_exist" on type "User".
      at document.graphql:6:9 {
    name: 'GraphQLDocumentError',
    message: 'GraphQLDocumentError: Cannot query field "i_do_not_exist" on type "User".'
  }
]

Fixed in v1.15.4

Was this page helpful?
0 / 5 - 0 ratings