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

regression in schema generation error reporting #4098

Closed
hkasemir opened this issue May 26, 2020 · 4 comments
Closed

regression in schema generation error reporting #4098

hkasemir opened this issue May 26, 2020 · 4 comments
Labels
dependencies waiting-for-release Fixed/resolved, and waiting for the next stable release

Comments

@hkasemir
Copy link
Contributor

Describe the bug
in upgrading from 1.13.5 to 1.15.0 I noticed that error reporting during schema generation became less clear. My server requires authorization to inspect, and the original error message if invalid auth was provided was

    Failed to load schema from ######/graphiql:

            Unable to download schema from remote: {
      "error": "Auth credentials are invalid",
      "error_code": "AUTH_INVALID_CREDENTIALS"
    }
            Error: Unable to download schema from remote: {
      "error": "Auth credentials are invalid",
      "error_code": "AUTH_INVALID_CREDENTIALS"
    }
        at UrlLoader.load (######/node_modules/@graphql-toolkit/url-loader/index.cjs.js:92:19)
        at processTicksAndRejections (internal/process/task_queues.js:97:5)
        at async loadFile (######/node_modules/@graphql-toolkit/core/index.cjs.js:78:24)
        at async ######/node_modules/@graphql-toolkit/core/index.cjs.js:481:24

            GraphQL Code Generator supports:
              - ES Modules and CommonJS exports (export as default or named export "schema")
              - Introspection JSON File
              - URL of GraphQL endpoint
              - Multiple files with type definitions (glob expression)
              - String in config file

            Try to use one of above options and run codegen again.
    Error: Failed to load schema
        at loadSchema (######/node_modules/@graphql-codegen/cli/bin.js:406:15)
        at processTicksAndRejections (internal/process/task_queues.js:97:5)
    Error: Failed to load schema
        at loadSchema (######/node_modules/@graphql-codegen/cli/bin.js:406:15)
        at processTicksAndRejections (internal/process/task_queues.js:97:5)

after updating, the error message is

    Failed to load schema from ######/graphiql:

        Cannot read property '__schema' of undefined
        TypeError: Cannot read property '__schema' of undefined
    at getSchemaFromIntrospection (######/node_modules/@graphql-tools/wrap/index.cjs.js:960:35)
    at Object.introspectSchema (######/node_modules/@graphql-tools/wrap/index.cjs.js:983:12)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async UrlLoader.load (######/node_modules/@graphql-tools/url-loader/index.cjs.js:78:30)
    at async loadFile (######/node_modules/@graphql-tools/load/index.cjs.js:48:24)
    at async ######/node_modules/@graphql-tools/load/index.cjs.js:425:24

        GraphQL Code Generator supports:
          - ES Modules and CommonJS exports (export as default or named export "schema")
          - Introspection JSON File
          - URL of GraphQL endpoint
          - Multiple files with type definitions (glob expression)
          - String in config file

        Try to use one of above options and run codegen again.
    Error: Failed to load schema
        at loadSchema (######/node_modules/@graphql-codegen/cli/bin.js:406:15)
        at processTicksAndRejections (internal/process/task_queues.js:97:5)
    Error: Failed to load schema
        at loadSchema (######/node_modules/@graphql-codegen/cli/bin.js:406:15)
        at processTicksAndRejections (internal/process/task_queues.js:97:5)

Expected behavior
Show the error message from the server to make it clear what the root cause is.

@dotansimha
Copy link
Owner

Thank you for reporting it @hkasemir .
It's a bug with @graphql-tools/.... @ardatan can you please take a look? )

@dotansimha
Copy link
Owner

@hkasemir can you please try 1.15.1-alpha-1f2eeae3.9?

@dotansimha dotansimha added the waiting-for-release Fixed/resolved, and waiting for the next stable release label May 27, 2020
@hkasemir
Copy link
Contributor Author

@dotansimha thanks for jumping on that so quickly!
confirmed that installing that version provides the auth errors again 🎉

@dotansimha
Copy link
Owner

Fixed in v1.15.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies waiting-for-release Fixed/resolved, and waiting for the next stable release
Projects
None yet
Development

No branches or pull requests

2 participants