Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Invalid Customer ID in admin Api

Invalid Customer ID in admin Api

kevinLi
New Member
4 0 1

Hi,

 

I am trying to update Customer with the admin GraphQL API (https://shopify.dev/docs/admin-api/graphql/reference/customers/customerupdate)

it shows Error message of: userErrors":[{"field":["id"],"message":"Cannot specify ID on creation"}]}}

kevinLi_0-1619463939549.png

 

The id I am using is: gid://shopify/Customer/5041754013902

(I can access the customer with the ID through https://chenstoretest.myshopify.com/admin/customers/5041754013902).  

Full payload of the shopify customer object:

kevinLi_1-1619464027950.png

 

Can I get some help why it always throws an error with the given ID? 

Thanks!

Reply 1 (1)

_JCC_
Shopify Staff
200 27 56

Hey @kevinLi 

Happy to help you out with this.

It looks like from the error in the first screenshot, customerCreate is being executed instead of the customerUpdate mutation. Looks like you're using a 3rd party library or perhaps have created your own to assist with utilizing our admin api. If possible, I'd try and do the a customerUpdate from a tool like Insomnia or Postman just to verify the update mutation works. 

Let me know how you make out and if you have any other questions.

Regards,

John

John C | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog