Hi Shopify Community,
I’m encountering an issue with the Shopify customerAddressUpdate mutation and need your assistance. I receive a 400 error with the message “Invariant Failed” when attempting to update or create an address using the Shopify API.
Here’s a summary of the problem:
-
Mutation Used: customerAddressUpdate
-
Error: 400 Bad Request, “Invariant Failed”
-
Issue: Despite providing the correct payload and ensuring that the mutation fields match Shopify’s API documentation, the error persists.
Details:
- GraphQL Mutation Query:
mutation customerAddressUpdate(
$address: CustomerAddressInput!
$addressId: ID!
$defaultAddress: Boolean
) {
customerAddressUpdate(
address: $address
addressId: $addressId
defaultAddress: $defaultAddress
) {
customerAddress {
id
firstName
lastName
address1
city
province
country
zip
}
userErrors {
code
field
message
}
}
}
Example Payload:
{
"address": {
"firstName": "xtz",
"lastName": "adfsa",
"company": "compose tech",
"address1": "55 Garden Place",
"address2": "Willoughby",
"city": "Willoughby",
"province": "New South Wales",
"country": "AU",
"zip": "2068",
"phone": ""
},
"addressId": "your-address-id",
"defaultAddress": false
}
Headers Used in Postman:
- Content-Type: application/json
- X-Shopify-Access-Token: your-access-token
Steps Taken:
- Verified that the GraphQL mutation and variables are correctly defined.
- Checked the format and values of the address data.
- Tested the mutation in GraphQL Playground with similar results.
Questions:
- Has anyone encountered a similar “Invariant Failed” error with this mutation?
- Are there specific requirements or constraints for the address object that might not be immediately obvious?
- Any tips on how to better debug or resolve this issue?
I appreciate any guidance or suggestions you can offer. Thank you!
Best regards,
Shilpe Saxena
