Webhook fires twice occasionally

26 views
Skip to first unread message

Christopher Burns

unread,
Mar 17, 2017, 1:54:24 PM3/17/17
to Shopify API (defunct)
Hi all,

I am having a weird issue where on occasion I will get two calls to my webhook within 1s of each other (usually on the order of a few hundred milliseconds).

I have a log writing out the timestamp of a call, with code that looks like this:

$insightlyAPI = new Insightly(INSIGHTLY_SECRET);

$hmacHeader = $_SERVER['HTTP_X_SHOPIFY_HMAC_SHA256'];

$requestBody = file_get_contents("php://input");

$isValidWebhookRequest = verifyWebhook($requestBody, $hmacHeader);

if ($isValidWebhookRequest) {
    LOG_ERROR("***** Webhook request from Shopify *****", LogLevel::HIGH);

    $orderJSON = json_decode($requestBody);

    processOrderData($orderJSON);
}
else {
    //  ERROR!!! Bogus request?
    LOG_ERROR("ERROR: Invalid webhook request from {$_SERVER['REMOTE_ADDR']}");
}

I get a call from Shopify, begin processing the order, and immediately get another webhook call, which causes all sorts of problems.

Is anyone else experiencing this?

Cheers,

Chris

Reply all
Reply to author
Forward
0 new messages