Why am I encountering a webhooks saving error in production?

Why am I encountering a webhooks saving error in production?

pavelSh
Shopify Partner
7 0 0

Hi! 

I'm creating a subscription for a "product/update" topic. It works fine on my development store, but I have issues when I try to launch it in prouction.

 

const webhook = new Webhook({ session: session });
      webhook.topic = "products/update";
      webhook.address = "https://api.splashup.co/items/update";
      webhook.format = "json";

      console.log("first update");
      try {
        await webhook.save({
          update: true,
        });
      } catch (error) {
        console.log(error);
      }

This is what I see in logs: 

 

 

first update
HttpRequestError: Failed to make Shopify HTTP request: FetchError: invalid json response body at https://noel-the-label.myshopify.com/admin/api/2022-04/webhooks.json reason: Unexpected end of JSON input

Could you please tell me, what can be the cause of this problem? I have a feeling that something maybe wrong with access restrictions. The current Scope of the app is "write products".

 

Any help is massively appreciated 🙂

 

Replies 0 (0)