Skip to content

Error: [] #32

Description

@HPieters

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions