Add mutation returns empty object

I am running this mutation:

mutation - returning id and title?

  mutation addTask($task: [AddTaskInput!]!) {
    addTask(input: $task) {
      task {
        id
        title
      }
    }
  }

task - input

{  
  task: [
    {
      title: 'something',
      completed: false,
      user: { username: email },
    }
  ]
}

with email being the logged in user…

While the mutation works fine, it returns an empty object at data.addTask:

task: []

Shouldn’t it return the new task with the id and title from my mutation? I was thinking graphql did return the query…

Thanks,
J

Do you have any auth add rules? If rules are not met, it will return empty. To be sure you are adding and maybe are restricted from querying with auth query rules return the numUids count

1 Like