Skip to content

Error output of codegen:generate is absurdly verbose #1297

@toolness

Description

@toolness

In version 2.12.3, running the following with a GraphQL file that has a validation error in it:

$ apollo codegen:generate --includes 'frontend/lib/queries/*.graphql' --localSchemaFile schema.json --target typescript --no-addTypename --outputFlat frontend/lib/queries/__generated__

produces the following output:

.../frontend/lib/queries/PasswordResetMutation.graphql: Cannot query field "LOLerrors" on type "PasswordResetPayload". Did you mean "errors"?
{ ToolError: Validation of GraphQL query document failed
    at Object.validateQueryDocument (/tenants2/node_modules/apollo-language-server/lib/errors/validation.js:32:19)
    at Object.generate [as default] (/tenants2/node_modules/apollo/lib/generate.js:22:18)
    at write (/tenants2/node_modules/apollo/lib/commands/client/codegen.js:67:54)
    at Task.task (/tenants2/node_modules/apollo/lib/commands/client/codegen.js:86:46)
    at <anonymous> name: 'ToolError' }
  ✔ Loading Apollo Project
  ✖ Generating query files with 'typescript' target
    → Validation of GraphQL query document failed
.../frontend/lib/queries/PasswordResetMutation.graphql: Cannot query field "LOLerrors" on type "PasswordResetPayload". Did you mean "errors"?
{ ToolError: Validation of GraphQL query document failed
    at Object.validateQueryDocument (/tenants2/node_modules/apollo-language-server/lib/errors/validation.js:32:19)
    at Object.generate [as default] (/tenants2/node_modules/apollo/lib/generate.js:22:18)
    at write (/tenants2/node_modules/apollo/lib/commands/client/codegen.js:67:54)
    at GraphQLClientProject.project.onDiagnostics [as _onDiagnostics] (/tenants2/node_modules/apollo/lib/commands/client/codegen.js:84:29)
    at GraphQLClientProject.validate (/tenants2/node_modules/apollo-language-server/lib/project/client.js:132:18)
    at GraphQLClientProject.validateIfNeeded (/tenants2/node_modules/apollo-language-server/lib/project/base.js:135:14)
    at Timeout.setTimeout [as _onTimeout] (/tenants2/node_modules/apollo-language-server/lib/project/base.js:127:22)
    at ontimeout (timers.js:498:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:290:5) name: 'ToolError' }
(node:117) UnhandledPromiseRejectionWarning: ToolError: Validation of GraphQL query document failed
    at Object.validateQueryDocument (/tenants2/node_modules/apollo-language-server/lib/errors/validation.js:32:19)
    at Object.generate [as default] (/tenants2/node_modules/apollo/lib/generate.js:22:18)
    at write (/tenants2/node_modules/apollo/lib/commands/client/codegen.js:67:54)
    at GraphQLClientProject.project.onDiagnostics [as _onDiagnostics] (/tenants2/node_modules/apollo/lib/commands/client/codegen.js:84:29)
    at GraphQLClientProject.validate (/tenants2/node_modules/apollo-language-server/lib/project/client.js:132:18)
    at GraphQLClientProject.validateIfNeeded (/tenants2/node_modules/apollo-language-server/lib/project/base.js:135:14)
    at Timeout.setTimeout [as _onTimeout] (/tenants2/node_modules/apollo-language-server/lib/project/base.js:127:22)
    at ontimeout (timers.js:498:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:290:5)
(node:117) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 5)
(node:117) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
ToolError: Validation of GraphQL query document failed
    at Object.validateQueryDocument (/tenants2/node_modules/apollo-language-server/lib/errors/validation.js:32:19)
    at Object.generate [as default] (/tenants2/node_modules/apollo/lib/generate.js:22:18)
    at write (/tenants2/node_modules/apollo/lib/commands/client/codegen.js:67:54)
    at Task.task (/tenants2/node_modules/apollo/lib/commands/client/codegen.js:86:46)
    at <anonymous>

This is extremely verbose and the only line that's really important is the very first one. The DeprecationWarnings are also concerning.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions