asp.net-coreautodesk-forgeautodesk-model-derivativeautodesk-webhooks

Why is the Autodesk Forge Model Derivative webhook firing multiple times?


I'm using the Autodesk Forge - Model Derivative service to convert a Revit (.rvt) file to IFC and SVF formats. To be notified when these conversions are done I have set up a webhook using the webhooks system Autodesk created for this purpose.

Now, when the conversion is done, the webhook succesfully sends a request to my given callback URL, but it does it more than once. And even the amount of times it fires isn't constant. It just fired the webhook twice in a minute, and then again after ten minutes. What could be a reason for this?

The problem is, that the first time the webhook fires, I can't even access the completed derivatives completely yet (I can't load the hierarchy and properties yet). It seems to be an issue on Autodesk's side, but I was wondering if anyone else encountered this problem.

This is the webhook I've created, and the only one on my account:

  "links": {
    "next": null
  },
  "data": [
    {
      "hookId": "<<hook id>>",
      "tenant": "jobstarted",
      "callbackUrl": "<<my url>>/callback",
      "createdBy": "2UbAPVbvWGfLAPHWLZD7Mld0bVRpI8aJ",
      "event": "extraction.finished",
      "createdDate": "2019-07-29T09:06:46.971+0000",
      "system": "derivative",
      "creatorType": "Application",
      "status": "active",
      "scope": {
        "workflow": "jobstarted"
      },
      "urn": "<<hook urn>>",
      "__self__": "/systems/derivative/events/extraction.finished/hooks/<<hook id>>"
    }
  ]
}

What I expect, is for the webhook to fire only once, so I can trust that I can access, download and use the entire derivative's data. Currently it's just unreliable.


Solution

  • Such behavior typically happens when our service did not receive a successful response from your end to the callbacks. Try divert the callbacks to a third party service (e.g. ngrok) and record them to isolate the issue. And see here for more details:

    Webhooks guarantees at least once delivery. When the event occurs, the webhooks service sends a payload to the callback URL as an HTTP POST request. The webhook service expects a 2xx response to the HTTP POST request. The response must be received within 6 seconds. A non-2xx response is considered an error. In the event of an error, the webhook service will retry immediately, in 15 minutes, and 45 minutes thereafter. The webhook service retries for 48 hours and disables the webhook if the callback does not succeed during this time. You may need to reconfigure your webhooks if they are disabled.