Graphql-engine: Insert mutation problem: No such type exists in the schema

Created on 15 Aug 2018  路  8Comments  路  Source: hasura/graphql-engine

Table name is lottery_tickets. Here is code:

  export const MUTATION_ADD = gql`
    mutation insertLotteryTicketsMutation ($objects: [lottery_tickets_input]){
      insert_lottery_tickets(objects: $objects) {
        affected_rows
        returning {
          id
        }
      }
    }
  `
  client.mutate({
    mutation: MUTATION_ADD,
    variables: {
      objects: [
        {
          ticketId: 3,
          timestamp: '1533810845',
          numbers: '11,12,13,14,15'
        }
      ]
     }
   })

I get this error: 400: No such type exists in the schema lottery_tickets_input.
Am i doing something wrong? Everything seems like it was described at your docs.
Hasura version v1.0.0-alpha12

docs quickfix bug

Most helpful comment

I had this same error and realized that I was not adding the appropriate header (my admin secret) when making the call. Thus, it was not able to find the schema and therefore didn't recognize the uuid type. Adding the correct auth resolved the problem.

All 8 comments

Solved. Seems like error at your docs.

[tablename]_input -> [tablename]_insert_input

@andreystarkov We'll update our docs asap! Keeping this issue open till that happens.
@rikinsk please take note!

@andreystarkov Could you share the docs page you noticed the bug on. I am having some trouble locating the exact source.

@rikinsk https://github.com/hasura/platform-docs/blob/master/platform/manual/guides/graphql-react.rst

At least this one, i saw same description at some other place, but cant find where at the moment.

Right. Those are actually docs for the Hasura Kubernetes platform which currently uses a very old version of GraphQL engine. Hence the discrepancy in its docs I believe.

Ok. So once we add docs on query variables here: https://docs.hasura.io/1.0/graphql/manual/mutations/insert.html we can close this.

Thank you guys!

I had this same error and realized that I was not adding the appropriate header (my admin secret) when making the call. Thus, it was not able to find the schema and therefore didn't recognize the uuid type. Adding the correct auth resolved the problem.

Was this page helpful?
0 / 5 - 0 ratings