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

fetching schema with http without explicitly specifying method causes unexpected 'No GraphQL schema.' error #112

Open
f4z3k4s opened this issue May 25, 2020 · 0 comments

Comments

@f4z3k4s
Copy link

f4z3k4s commented May 25, 2020

Describe the bug
Not explicitly defining "method": "POST" in tsconfig.json causes npx ts-graphql-plugin validate --verbose to fail. On top of that, it fails with a wrong error message so it took me a good half hour to figure out. It fails with the following error message:

error: No GraphQL schema. Confirm your ts-graphql-plugin's "schema" configuration at tsconfig.json's compilerOptions.plugins section.

To Reproduce
Use schema over http without explicitly specifying method, like:

"plugins": [
      {
        "name": "ts-graphql-plugin",
        "schema": {
          "http": {
            "url": "http://xy.com/graphql", // whatever your graphql endpoint is
            // "method": "POST"  // do not specify it explicitly and it will fail
          }
        },
        "tag": "gql"
      }
    ]

Expected behavior
I've read in the documentation that one can omit "method": "POST" from tsconfig.json since that is the default. If that is not explicitly written in config, plugin silently fails, even with verbose flag. Either the documentation could be updated (willing to do a PR if needed) and error message could be updated, or it should be fixed in the package to fallback to POST even if not explicitly defined.

PS: great plugin and keep it going, thanks for your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant