Webhook for product.updated is not working

curl

#1

this is the continuation from --> Webhook notification
i have updated some products and for most of them i got the webhook notification but looks like 1 or 2 didnt make it.

your webhooks are waiting for the response from the URL, and re-try if you get any answer different to 2XX.

what is your strategy here? also are you saving the logs?


#2

Hi @sebastian11c

You can view your event logs by following the documentation here: https://docs.moltin.com/advanced/events/logs

I can see that you have two integrations set up on your account and they are enabled

{
   "data":[
      {
         "id":"9b666bbe-1b96-4814-9d45-29991afd6f3c",
         "type":"integration-log",
         "succeeded":false,
         "attempt":1,
         "processing_time":0.8253,
         "body":"<html>\r\n<head
><title>502 Bad Gateway</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>502 Bad Gateway</h1></center>\r\n<hr><center>nginx/1.10.3</center>\r\n</bod
y>\r\n</html>",
         "status_code":502,
         "error_detail":"Received a status code outside of 2xx range - treating webhook as a fail",
         "relationships":{
            "integration":{
               "data":{
                  "type":"integration",
                  "id":"560f8204-18ff-48d4-8c2d-fc781fe357d1"
               }
            },
            "job":{
               "data":{
                  "type":"integration-job",
                  "id":"2856c4c7-913f-42de-8436-83a696682fe5"
               }
            }
         },
         "meta":{
            "timestamps":{
               "created_at":"2018-11-08T15:39:00.027471229Z"
            }
         }
      },
      {
         "id":"23c4bb0b-8366-4ab1-b498-335352fc4786",
         "type":"integration-log",
         "succeeded":true,
         "attempt":1,
         "processing_time":1.1235,
         "body":"",
         "status_code":200,
         "error_detail":"",
         "relationships":{
            "integration":{
               "data":{
                  "type":"integration",
                  "id":"560f8204-18ff-48d4-8c2d-fc781fe357d1"
               }
            },
            "job":{
               "data":{
                  "type":"integration-job",
                  "id":"4b29ccbf-5938-4b47-a309-fb00c11e1038"
               }
            }
         },
         "meta":{
            "timestamps":{
               "created_at":"2018-11-08T15:40:58.36596263Z"
            }
         }
      },
      {
         "id":"bbccab79-0414-4f46-b828-3107ccbf4c9d",
         "type":"integration-log",
         "succeeded":true,
         "attempt":1,
         "processing_time":3.5         027,
         "body":"",
         "status_code":200,
         "error_detail":"",
         "relationships":{
            "integration":{
               "data":{
                  "type":"integration",
                  "id":"560f8204-18ff-48d4-8c2d-fc781fe357d1"
               }
            },
            "job":{
               "data":{
                  "type":"integration-job",
                  "id":"cbcc4441-10b0-4540-b098-7e3f1ee759a2"
               }
            }
         },
         "meta":{
            "timestamps":{
               "created_at":"2018-11-08T15:47:26.588070172Z"
            }
         }
      },
      {
         "id":"1c06ed45-b198-4848-bb32-d6dccdfcbfa4",
         "type":"integration-log",
         "succeeded":true,
         "attempt":1,
         "processing_time":0.2182,
         "body":"",
         "status_code":200,
         "error_detail":"",
         "relationships":{
            "integration":{
               "data":{
                  "type":"integration",
                  "id":"560f8204-18ff-48d4-8c2d-fc781fe357d1"
               }
            },
            "job":{
               "data":{
                  "type":"integration-job",
                  "id":"403ab085-cad7-4fc9-b6d2-134224b4f18f"
               }
            }
         },
         "meta":{
            "timestamps":{
               "created_at":"2018-11-08T15:54:05.359661554Z"
            }
         }
      }
   ]
}

Looking at the logs we can see that one of the jobs has failed with a 5xx error, are you able to give me some information about how you are updating the products?

Thanks

Drew


#3

hi @drew thanks for your answer, how can i get more granular data about the webhook thatd fialed? example, product id, etc


#4

also, if the webhook failed , what can we do about it? moltin re-try to execute the webhook? how can i get an alert when this happens to react some how?


#5

Hi @sebastian11c

The 502 has been generated on your side as opposed to the moltin API, so when the API called your endpoint it was unresponsive and sent a 502 response to the API. You could traverse your logs to check for 502 error to see why this has happened.

Hope this helps

Drew