After trying to run a React app, I get the following error:
"GraphQLError: Syntax Error: Expected Name, found ["
The specific mutation the error references is:
import gql from "graphql-tag";
export default gql(`
mutation($name: String!, $address: String!, $phoneNumber: String!,
$allegedOffenses: String!, $courtDates: [AWSDate]!) {
createClient(
name: $name,
address: $address,
phoneNumber: $phoneNumber,
allegedOffenses: $allegedOffenses,
courtDates: $[AWSDate]
) {
id,
name,
address,
phoneNumber,
allegedOffenses,
courtDates,
comments {
items {
commentId
}
}
}
}`);
I tried using the troubleshooting steps found at GraphQLError: Syntax Error: Expected :, found {, but didn't have any luck. Any thoughts?
Typo in the mutation for courtDates parameter..
createClient(
name: $name,
address: $address,
phoneNumber: $phoneNumber,
allegedOffenses: $allegedOffenses,
courtDates: $[AWSDate]
)
should be:
createClient(
name: $name,
address: $address,
phoneNumber: $phoneNumber,
allegedOffenses: $allegedOffenses,
courtDates: $courtDates
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With