GraphQL mutation error when adding new customer through Shopify API in Android app

GraphQL Parse Error When Adding Customer via Shopify API

I’m building an Android application that integrates with Shopify. I keep getting a parse error whenever I try to add a new customer using GraphQL mutations. The error mentions something about a parse issue with curly braces but I can’t figure out what’s wrong with my syntax.

My Current Implementation

const createUserMutation = `mutation addNewCustomer($customerData: CustomerCreateInput!) {
  customerCreate(input: $customerData) {
    customer {
      acceptsMarketing
      email
      firstName
      lastName
      phone
    }
    customerUserErrors {
      field
      message
      code
    }
  }
}`;

const mutationVariables = {
  "customerData": {
    "acceptsMarketing": false,
    "email": "[email protected]",
    "firstName": "Sarah",
    "lastName": "Doe",
    "password": "myPass123",
    "phone": "+1234567890"
  }
};

async function executeGraphQLQuery(mutation, variables) {
  return fetch('https://mystore.myshopify.com/api/graphql.json', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-Shopify-Storefront-Access-Token': accessToken,
    },
    body: JSON.stringify({
      query: mutation,
      variables: variables
    }),
  })
    .then(res => res.json())
    .then(data => console.log('API Response: ', data))
    .catch(err => console.log('Request failed: ', err.message));
}

Error I’m Getting

{"errors": [{"locations": [Array], "message": "Parse error on \"{\" (LCURLY) at [16, 20]"}]}

Has anyone encountered this type of parsing error before? What could be causing the issue with the curly brace syntax?