Hi , I am trying to sync a product from shopify to a sales channel using graphQL but it always gives an error saying invalid ID. But I checked both ,the channel id and the product ID, are correct. Below is a code snippet. Can anyone suggest something ?
I also had to contact support to activate the following scope: write_publications.
However, even with that I kept getting the invalid ID issues. I tried multiple IDs similar to yours, but none seemed to work. Contacted support again to see if they could help me with the ID format, but for some reason this is out of their area of support. The issue seems to be in the resource ID not the channel ID according to my testing.
I’ll post my workaround, but as a disclaimer this isn’t the ideal solution.
Programming Language Ruby 2.3.4 and the Shopify gem 4.12.0
Alternative GraphQl Mutation: PublishablePublishToCurrentChannel
Product ID Format: “gid://shopify/Product/<product_id>”
CurrentChannel: Private App used to initialize the Shopify gem or authenticate through the ShopifyAPI. (this is where it differs with PublishablePublish mutation where the private app ID is passed as an argument).
Why is this not an ideal solution? Because it forces you to reinitialize the Shopify gem (and ShopifyAPI::GraphQl module, which is expensive). Anyway, since the ShopifyAPI Gem is thread safe I delegated this mutation to a background job and had no issues so far.