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 global id (Product Variant) while Updating Cart with Buy SDK

Invalid global id (Product Variant) while Updating Cart with Buy SDK

pehzet
Tourist
4 0 0

Hello,
I am trying to update a Checkout by using the Buy SDK, but it throws this Error:

__________________________________________________

Error: [{"message":"Variable $lineItems of type [CheckoutLineItemUpdateInput!]! was provided invalid value for Error: [{"message":"invalid id","locations":[{"line":1,"column":3136}],"path":["checkoutLineItemsUpdate"]}]
at C:\code\you-at-campusfoods\node_modules\shopify-buy\index.js:3847:29

______________________________________________

I am using the right gid-id and also encoded it to base64 (Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0VmFyaWFudC80MjEyODY2ODU5MDMxNA==). The id is straight from the node admin api. There is also a specific field for it inside the admin API:
admin_graphql_api_id: 'gid://shopify/ProductVariant/42128668590314'

Thank you in advance!

 

Philipp

Replies 2 (2)

c10s
Shopify Partner
67 12 27

Not sure what API version you're using but could be related to this: https://shopify.dev/api/examples/object-ids (object ids no longer need to be encoded)

pehzet
Tourist
4 0 0

Hey,
I'm using 2022-04 for the webhook API. For the Buy SDK I use the default. I'm not sure which it is, sorry. According to the documentation it should be encoded, but when I encode it says 'invalid id'. If not it says 'invalid global id' ...

Thank you!