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

Errors during generation are non-existent #8366

Closed
chriswetterman opened this issue Sep 19, 2022 · 17 comments · Fixed by #8525
Closed

Errors during generation are non-existent #8366

chriswetterman opened this issue Sep 19, 2022 · 17 comments · Fixed by #8525
Assignees
Labels
stage/5-alpha-release-testing The pull request is merged, an alpha release is available, to be tested

Comments

@chriswetterman
Copy link

chriswetterman commented Sep 19, 2022

Describe the bug

I've recently updated to v2 of the CLI and the associated plugins. Since then the errors that are reported are not helpful in that only a partial of the error is displayed. This makes tracking down errors extremely more challenging. Please see the below screenshots and information. I have used the debug and errorsOnly flags and they do not provide any additional information toward identifying the reason and therefore cause of the failure.

Your Example Website or App

None provided

Steps to Reproduce the Bug or Issue

To reproduce I have the following CLI version and plugins installed which at the time are the most current versions. Create a query/mutation that is incorrect or doesn't exist to cause any error in generation. Review the reported errors.

Expected behavior

As a user, I am expecting to see detailed enough errors to allow me to track down my errors to resolve. Version 1 of the CLI provided adequate information around errors.

Screenshots or Videos

image
image

Platform

  • OS: Windows
  • NodeJS: 14.18.0
  • @graphql-codegen/cli@2.12.0
  • @graphql-codegen/typed-document-node@2.3.3
  • @graphql-codegen/typescript@2.7.3
  • @graphql-codegen/typescript-operations@2.5.3

To reproduce I have the following CLI version and plugins installed which at the time are the most current versions.

Codegen Config File

schema:
  - https://graphql-federated-gateway...../graphql
  - 'schema.graphql'
documents: './src/**/*.graphql'
generates:
  ./src/generated/graphql.tsx:
    config:
      enumsAsConst: true
    plugins:
      - typescript
      - typescript-operations
      - typed-document-node

Additional context

No response

@chriswetterman chriswetterman changed the title Errors during generation are not Errors during generation are non-existent Sep 19, 2022
@charlypoly charlypoly self-assigned this Sep 20, 2022
@wesselvdv
Copy link

I am seeing the same issue, errors are no longer being displayed. The only thing I get is the following statement Unable to validate GraphQL document!, but where it is, is not being shown. It did do this before.

@charlypoly
Copy link
Contributor

@chriswetterman, I tested a similar setup locally.
GraphQL Code Generator relies on Listr for console output, which truncates the content of logs depending on your terminal width (at print time, not dynamically).
To avoid this, I recommend that you run codegen in verbose mode, as follows:

yarn graphql-codegen -r dotenv/config -v

@charlypoly charlypoly added the stage/3-local-solution A user has a possible solution that solves the issue label Sep 22, 2022
@chriswetterman
Copy link
Author

Hi @charlypoly, I added the verbose flag and didn’t see any change in the output as it’s still truncated. Again this is in VS Code and I tried in both powershell and bash terminals.

@charlypoly charlypoly added stage/0-issue-prerequisites Needs more information before we can start working on it and removed stage/3-local-solution A user has a possible solution that solves the issue labels Sep 23, 2022
@charlypoly
Copy link
Contributor

@chriswetterman, okay, we will investigate further.

@wesselvdv, do you also face this issue on Windows or on another OS?

@hannahborel
Copy link

two thumbs way up

@chriswetterman
Copy link
Author

@charlypoly We have another project that's on cli@2.6.2 and it reports a plethora of errors as expected and I've rolled back to that for now. I just tested on cli@2.13.4 and the issue still persists (our Nexus repo doesn't have 2.13.5 yet to test). Currently don't have the bandwidth to narrow down exactly which release the issue began with but hopefully this gives you some more info. I'll circle back when things free up on my end. Thanks.

@chriswetterman
Copy link
Author

It appears graphql-codegen/cli@2.9.1 introduced the issue

@charlypoly
Copy link
Contributor

Hi @hannahborel, @wesselvdv,

Could you confirm that you also face this bug only on Windows?
I could not reproduce it on MacOS.

@wzalazar
Copy link

@charlypoly I can confirm downgrading the version to 2.9.0 is working well on Mac. If I install version 2.10.0 or above it doesn't work.

@pleunv
Copy link

pleunv commented Oct 18, 2022

I can also confirm that the issue occurs on macOS as well. Reverting the CLI to 2.9.0 does indeed fix it and reintroduces error information in addition to just "Unable to validate GraphQL document!".

@charlypoly
Copy link
Contributor

Hi all,

The culprit is most likely the following commit: e2cfc5c

However, reverting this commit will bring back another bug that printed all error messages twice.

The root cause of the error truncating issue seems to be linked to our migration to Listr2, which I experienced, which seems to truncate all logging containing multiple lines.

There is no easy fix regarding this issue, and we prioritize it as one of the first things to tackle as part of the v3 roadmap.

@charlypoly charlypoly added stage/1-reproduction A reproduction exists and removed stage/0-issue-prerequisites Needs more information before we can start working on it labels Oct 24, 2022
@chriswetterman
Copy link
Author

Much appreciated, @charlypoly. Thank you and looking forward to v3.

@charlypoly
Copy link
Contributor

charlypoly commented Oct 25, 2022

Hi @chriswetterman, hi all,

Could you give a try to the following canary release of @graphql-codegen/cli?

Package Version Info
@graphql-codegen/cli 2.13.8-alpha-20221025134913-ec8a36be2 npm ↗︎

It should fix the issue of error truncating on Windows and also most of the issues of error details on all platforms.

@charlypoly charlypoly added stage/5-alpha-release-testing The pull request is merged, an alpha release is available, to be tested and removed stage/1-reproduction A reproduction exists labels Oct 25, 2022
@charlypoly
Copy link
Contributor

@pleunv @wesselvdv @chriswetterman @hannahborel, any feedback with the canary version suggested above?

@mvestergaard
Copy link
Contributor

@charlypoly I just encountered this problem, and tried out the changes you made in #8525, and they do appear to resolve the issues.

@charlypoly
Copy link
Contributor

A fix has been released in @graphql-codegen/cli@2.13.9 📦
Please make sure to also update all your @graphql-codegen/* packages.

@pleunv
Copy link

pleunv commented Nov 4, 2022

@pleunv any feedback with the canary version suggested above?

Apologies, completely missed this. Just want to confirm that this does in fact also fix the issue for us. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage/5-alpha-release-testing The pull request is merged, an alpha release is available, to be tested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants