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

Error: [] #32

Open
HPieters opened this issue Jul 29, 2019 · 0 comments
Open

Error: [] #32

HPieters opened this issue Jul 29, 2019 · 0 comments

Comments

@HPieters
Copy link

HPieters commented Jul 29, 2019

I ran to a small issue when running this library. I am running the library directly from node_modules like so ./node_modules/.bin/get-graphql-schema [local_grapql_endpoint] > schema.graphql.

However I get:

Error: []
    at /node_modules/get-graphql-schema/dist/index.js:177:19
    at step (/node_modules/get-graphql-schema/dist/index.js:112:21)

The issue seems to be that the .json() function on the result returns an empty errors array. And it triggers https://github.com/prisma/get-graphql-schema/blob/2e8732322ba52158aa6bb163de3d7107a041cc52/src/index.ts#L65 to be true... If I remove the line from the source or check for errors.length > 0 it all works as expected.

Doing a little more research I found that this snippet also returns an empty array.

const fetch = require('node-fetch')

fetch(' [local_grapql_endpoint]')
  .then(res => res.json())
  .then(({errors}) => console.log(errors))

The solution to me seems to check if errors has length larger than 0, I could create a pull request if required.

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