Closed xenoterracide closed 2 years ago
@xenoterracide the error should be visible. Are you running this as a script from a package manager? (seems like Yarn 2?) can you please share a reproduction of that issue in a sandbox?
thanks!
yes, yarn2, nodelinking, I'll see what I can do sometime this week
Got it, thanks. Can you please share a reproduction with the complete set of tooling you are using?
@dotansimha I am also getting this error. Here is a reproduction:
https://github.com/TheAschr/graphql-codegen-errors-reproduction
As a local & temporary workaround, I added a print of the document errors, here is the kind of helpful output I got this way :
Error [GraphQLDocumentError]: Variable "$serviceId" of type "String!" used in position expecting type "ID!". at [...]/src/graphql/service-operation-mutations.graphql:3:3
I put errors.forEach(console.log);
in file node_modules/@graghql-tools/utils/index.js
, line 960 as of version 8.0.2.
function checkValidationErrors(loadDocumentErrors) {
if (loadDocumentErrors.length > 0) {
const errors = [];
for (const loadDocumentError of loadDocumentErrors) {
...
}
errors.forEach(console.log); // ADDED THIS UGLY THING
throw new exports.AggregateError(errors, `GraphQL Document Validation failed with ${loadDocumentErrors.length} errors`);
}
}
I'd be happy to fill a PR if given some insight on logging strategy of codegen !
In fact, since version 8.2.0 (see commit), the error message are much nicely built:
throw new AggregateError(
errors,
`GraphQL Document Validation failed with ${errors.length} errors;
${errors.map((error, index) => `Error ${index}: ${error.stack}`).join('\n\n')}`
);
@dotansimha Issue should be closed as on graphql-tools side & resolved.
I found that listr
was encapsulating errors in some cases.
This PR unpacks those errors, and includes those details in the CLI error output.
https://github.com/dotansimha/graphql-code-generator/pull/6921
Hi all!
CLI errors output has been improved in @graphql-codegen/cli@2.5.0
!
Thank you @jlmessenger for your contribution ⚡
this is what I'm running
but what is it failing on? what was it looking at? please improve the failure outputs to include what was being processed at the time. Here's the schema I've been working on
DEBUG is a decent solution, but I need this #4946, also I think it could be just reduced to