Graphql-tools: Input type not accepted by mandatory parameter

Created on 31 May 2018  路  7Comments  路  Source: ardatan/graphql-tools

To reproduce the issue I create a new simple schema:

contact(
        id: Int!   -> This query required a mandatory input parameter
): Contact

type Contact {
    id: Int
    firstname: String
    lastname: String
    avatar: String
}

So from my client (ex. graphiql) I send this query:

query getContact($id: Int!) {
    contact(id: $id) {
        id
        firstname
        lastname
        avatar
    }
}

and with query parameters:

{
  "id": 10
}

So I received this error:

Argument "id" of required type "Int!" was provided the variable "$id" which was not provided a runtime value.

But if I flag the input parameter in Contact entity not required, as below:

contact(
        id: Int  -> This query doesn't require a mandatory input parameter
): Contact

all works well. I tried with an input parameter as string and changing the parameter name, but I have always the same issue. I think the issue is related only by the mandatory/optional input parameter

has-reproduction

Most helpful comment

Experiencing the same issue

All 7 comments

Experiencing the same issue

Same issue occurred in my project too :( Please help!!! Server return 400 HTTP status, but all variable data passed correctly. But this issue reproduced not for all requests, but sometimes consecutive requests return 400 error

seems what update apollo-server-express library to 2.0.6 fix a problem

Seems problem detected again :( try to reproduce stable scenario for detecting this problem

Got the same problem as well, had no clues why this would happen despite I still got an argument in my resolver anyway. I had to remove non-null assertion in my type definition though.

Sorry guys, any news on this issue? May when it will be fixed? Thanks for your great job as well!

Closing for now. This seems like a client, server or graphql-js error... Possibly.

Please reopen with a minimal reproduction as relevant.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alfaproject picture alfaproject  路  4Comments

stubailo picture stubailo  路  3Comments

avnersorek picture avnersorek  路  3Comments

capaj picture capaj  路  4Comments

flippidippi picture flippidippi  路  3Comments