Internal Server Error, panic trapped


Report a GraphQL Bug

What edition and version of Dgraph are you using?

Edition:

  • SlashGraphQL
  • Dgraph (community edition/Dgraph Cloud)

If you are using the community edition or enterprise edition of Dgraph, please list the version:

Dgraph Version
$ dgraph version
 
PASTE YOUR RESULTS HERE

Have you tried reproducing the issue with the latest release?

Yes

Steps to reproduce the issue (paste the query/schema if possible)

I tried running this query:

mutation {
  updatePollResponse(
    input: {
      filter: {objectiveID: [<id>]},
      set: {score: 0, correct: true}
    } 
  ) {
    pollResponse {
      ...
    }
  }
}

Expected behaviour and actual result.

When running the query, I get this error:

Error: Internal Server Error - a panic was trapped.  This indicates a bug in the GraphQL server.  A stack trace was logged.  Please let us know by filing an issue with the stack trace.

I have seen past issues where it was caused by IDs not being passed in as lists, but I checked and the IDs passed in the filter are being passed as a list. Not sure how to debug this.


Hmm I don’t think this is correct GraphQL syntax?

This appears like a bug. Can you share schema, especially the type, PollResponse and the Dgraph version so that we can try reproducing this.

I tried reproducing this on latest slash release with the following schema,

type Post1 {
    id: ID!
    name: String!
}

and mutation,

mutation{
  updatePost1(input:{filter:[{id:"0x34"}],set:{name:"something"}}){
    post1{
      id
      name
    }
  }
}

But it seemed to work fine and it did not throw any error.

Dgraph version = v20.11.2-rc1-16-g4d041a3a

PollResponse Schema:

type PollResponse implements IMetadata & IEntity @generate(
    mutation: {
        add: false,
        delete: false,
        update: true
    }
) {
    poll: Poll!
    voter: User!
    vote: Option!
    correct: Boolean @search
    score: Float
}

Hi @JSPromisel ,

Thanks for providing the schema of PollResponse and the Dgraph version. Can you also provide schema of interfaces IMetadata and IEntity (whichever has objectiveID in it) ?

As those interface types were not described, I tried reproducing this with the following simplistic schema, but couldn’t reproduce. The update mutation worked fine.

Schema:

interface IEntity {
    objectiveID: ID!
}

type PollResponse implements IEntity {
    correct: Boolean @search
    score: Float
}

Mutation:

mutation{
  updatePollResponse(input:{filter:{objectiveID:["0x4"]}, set:{correct:false, score:1}}){
    pollResponse{
      objectiveID
      correct
      score
    }
  }
}

I can also see that in a separate discuss post Auth rule fails to filter on field in type , objectiveID if part of User and User is part of PollResponse .
Note that Dgraph does not support nested filters in mutations currently. It is not possible to filter PollResponse using fields of User