I'm using ReactJS and aws-amplify
to execute graphql operations.
CODE:
import {
API,
graphqlOperation
} from 'aws-amplify';
import { UpdateInput } from './mutations.js';
// Call mutation
const input = { /* some values */ };
API.graphql(graphqlOperation(UpdateInput, input)).then(...);
GraphQL mutation definition:
export const UpdateInput = `mutation UpdateInput($input: Input!) {
updateInput(input: $input) {
id,
name
}
}`
GraphQL Schema:
input Input {
id: ID!
name: String
}
type Mutation {
updateInput(input: Input!): String
}
However, I get an error:
[Log] Variable 'input' has coerced Null value for NonNull type 'Input!'
Using AWS console my mutation works and input
is NonNull (using a debugger)
Any ideas what's causing the error?