Re: Help Needed: 400 Error with "Invariant Failed" on Shopify customerAddressUpdate Mutati

I'm encountering an issue with the Shopify customerAddressUpdate mutation and need your assistance. I get 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 error "Invariant Failed" 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. https://shopify.dev/docs/api/storefront/2024-10/mutations/customerAddressUpdate Even after adjusting the query to match the expected fields, I am still encountering the same error message. I expected the customer address to be updated.

Comment (0)

You’ll be in good company