Troubleshooting

Common Errors and How to Solve Them

StepZen CLI Errors

1. GraphQL Errors

Say you run stepzen start and you see:

Starting...... !

Your local schema has the following GraphQL errors:

Error: Unknown type "continentFilterInput".
Did you mean "ContinentFilterInput" or "LanguageFilterInput"?

If the StepZen CLI lets you know that you have GraphQL errors, it is helpful to check for a a typo in your GraphQL schema. GraphQL is case-sensitive, and here you can see that the error is helpfully picking up a type that should be spelled with a capital 'C' in order to be referenced properly.

Another GraphQL error you might run into looks like:

Your local schema has the following GraphQL errors:

Error: Cannot find file graphql/ap_spacex_land.graphql

This means StepZen cannot find the file by the path I'm providing in index.graphql. If I go into the file and correct the typo (a missing 'i' in graphql/ap_spacex_land.graphql), the error disappears:

schema @sdl(files: ["graphql/api_spacex_land.graphql"]) {
  query: Query
}

GraphiQL Errors

1. HTTP Error

If you see:

  "errors": [
    {
      "message": "Connector: HTTP Error: Bad Request",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],

This usually means there's something going on with your URL when you make the request. Is it formatted correctly?

2. Failed to Fetch

If you hit play and get this in response:

{
  "message": "Failed to fetch",
  "stack": "TypeError: Failed to fetch"
}

It often means that your endpoint's not currently up. Double-check to see that stepzen start is running.

3. Cannot query field on type

Say you're working with a SpaceX API and you make this request:

query MyQuery {
  capsules {
    id
    limit
    landings
    original_launch
    reuse_count
  }
}

and get this response:

{
  "data": null,
  "errors": [
    {
      "message": "Cannot query field \"limit\" on type \"Capsule\".",
      "locations": [
        {
          "line": 4,
          "column": 5
        }
      ]
    }
  ]
}

That's because 'limit' is not defined on the capsules query inside the schema file:

  capsules(
    find: CapsulesFind
<!--     limit should be here -->
    offset: Int
    order: String
    sort: String
  ): [Capsule]
    @graphql(
      endpoint: "https://api.spacex.land/graphql/"
    )

If it's added back in, the error will disappear. So an error message letting you know you can't query a field on a type usually means you're referring to an field in my query that's unavailable for one reason or another-- a typo, or perhaps an unrefreshed page.

A Helpful Query to Add to Your Schema When Things Go Wrong

This schema uses httpbin.org to return information about your request:

type debug {
  args: JSON
  data: JSON
  files: JSON
  form: JSON
  headers: JSON
  json: JSON
  method: String
  url: String
}

type Query {
  debugger(id: String!): debug
    @rest(endpoint: "https://httpbin.org/anything/$id")
}

The 'id' is optional and provides a nice way to see what gets sent to the backend from StepZen, if you've got an id parameter you want to check on.

Basically, this endpoint returns back what is sent to that endpoint in a visible way. The response could help you see, for example, that the url is getting formatted in the way that you are assuming.

This site uses cookies: By using this website, you consent to our use of cookies in accordance with our Website Terms of Use and Cookie Policy.