0

I'm trying to remove the pooling and integrate webhooks in the process of file conversion. The problem is that the webhook is created but the callback is never called back.

I'm following the instructions from here: https://forge.autodesk.com/en/docs/webhooks/v1/tutorials/create-a-hook-model-derivative/

The web server is started by the following command : ngrok http host-header=rewrite https://localhost:44366

The callback is http://f36a47b8.ngrok.io/derivative and is up and running. Post requests from postman(internal network) and Post requests from external networks (cellular data) are reaching the endpoint and are successfully redirected.

A hook is created:

  "hookId": "51897b50-522a-11ea-b885-f34f23e3435e",
  "tenant": "c0761189-32dd-4ca3-9e52-3ae400f91651",
  "callbackUrl": "http://f36a47b8.ngrok.io/derivative",
  "createdBy": "HUpqLPysSUmbFGlhQo0uG8XMqimfQnRG",
  "event": "extraction.updated",
  "createdDate": "2020-02-18T08:40:29.829+0000",
  "system": "derivative",
  "creatorType": "Application",
  "status": "active",
  "scope": {
    "workflow": "c0761189-32dd-4ca3-9e52-3ae400f91651"
  },
  "urn": "urn:adsk.webhooks:events.hook:51897b50-522a-11ea-b885-f34f23e3435e",
  "__self__": "/systems/derivative/events/extraction.updated/hooks/51897b50-522a-11ea-b885-f34f23e3435e"
}

Than a call to modelderivative/v2/designdata/job is issued with the following content:

 var job = new JobRequest
            {
                Input = new Input
                {
                    Urn = urnBase64,
                },
                Output = new Output
                {
                    Formats = new List<Format>
                    {
                        new Format
                        {
                            Type = "svf",
                            Views = new List<string> { "2d", "3d" }
                        }
                    },
                    Destination = new Destination { Region = "EMEA" }
                },
                Misc = new Misc
                {
                    Workflow = workflowId
                }
            };

The response is success with an urn (like before);

And from that point nothing follows from the webhook. The callback is never reached, even though that within some time the file is converted and it can be loaded in the viewer as before.

I've viewed those topics:

Unable to receive Forge webhooks, or unable to get them to fire

Why is webhook workflow not taken into consideration when creating modelderivative job?

but they didn't helped.

What am i missing ?

  • A few things to check: are you sure you wanted o redirect callbacks to your localhost in secure protocol (https) - use ngrok's [inspection UI](https://ngrok.com/docs#inspect) to verify if the callbacks do arrive? Did `workflowId` matched in your webhook and job payloads? – Bryan Huang Feb 18 '20 at 10:20
  • 1. The workflowId is the same. 2. I'm using it and no requests from forge are coming (i'm also watching the debug window of the program itself). 3. I've also tried with extraction.updated and extraction.finished events, but still nothing. Could it be that the region for the job request is `EMEA` but the region of the ngrok is `United States (us)` ? – Theodor Pavlov Feb 18 '20 at 10:59
  • `Could it be that the region for the job request is EMEA but the region of the ngrok is United States (us)` - nope but there's a known issue with the EMEA region where webhooks might behave erratically so try US and it should work – Bryan Huang Feb 19 '20 at 05:02
  • Thanks! Changing the region to 'us' was the deal. Where can i get info for those well know issues ? – Theodor Pavlov Feb 19 '20 at 08:51

1 Answers1

1

It turns out that there is a problem with jobs for derivative API in 'EMEA' region where no callbacks are called when a job finishes. Changing the region to 'us' fixes the issue and callback is hit when a job event occurs.

From the documentation example change the region parameter:

curl -X 'POST' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -H 'Authorization: Bearer PtnrvrtSRpWwUi3407QhgvqdUVKL' \
     -H 'x-ads-force: false' -v 'https://developer.api.autodesk.com/modelderivative/v2/designdata/job' \
     -d
'{
   "input": {
     "urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bW9kZWxkZXJpdmF0aXZlL0E1LnppcA",
     "compressedUrn": true,
     "rootFilename": "A5.iam"
   },
   "output": {
     "destination": {
       "region": "us" <- Change the region form 'EMEA' to 'us'
     },
     "formats": [
       {
         "type": "svf",
         "views": [
           "2d",
           "3d"
         ]
       }
     ]
   }
 }'