question

ElAbedHoussemIDT-6342 avatar image
0 Votes"
ElAbedHoussemIDT-6342 asked ElAbedHoussemIDT-6342 answered

Azure Logic app is blocked after calling HTTP Webhook

Hello, I am trying to139476-metut.png create the following workflow:


This flow it will be lunched each month. The logic app will use an HTTP Webhook to call an Orchestrator Azure function. This Orchestrator Azure function will call a two other Azure function.

I am using the Azure Orchestrator function because the two other azure functions take a lot of time to be executed, and in this case we are speaking about durable functions because otherwise if the logic app doesn't receive a response after some time(after some retries also) it will end with error. So the orchestrator will solve this issue by sending 202 response and make the logic app waiting until the azure functions ends they work (https://docs.microsoft.com/en-us/azure/azure-functions/durable/quickstart-python-vscode). The following picture shows I am calling the Orchestrator:
139477-suggh.png

After receiving a 200 status from the HTTP Webhook which indicates that the azure functions finish working with success, it will go to the next step where we call an Azure pipeline , and then we will send an email about the status of the devops pipeline(if it ends with success or failed).

So this is the description of what I am doing.

**My Problem is t**hat the Logic app is blocked in the call of the HTTP Webhook. I already checked the azure functions and they works well, and I have already check there outputs by checking the logs and they end with success.

I don't know the problem comes from where exactly.

This is the code of the azure Orchestrator Function Starter:


 import azure.functions as func
 import azure.durable_functions as df
    
    
 async def main(req: func.HttpRequest, starter: str) -> func.HttpResponse:
     client = df.DurableOrchestrationClient(starter)
     instance_id = await client.start_new(req.route_params["functionName"], None, None)
    
     logging.info(f"Started orchestration with ID = '{instance_id}'.")
    
     return client.create_check_status_response(req, instance_id)

This s the code of Orchestrator that calls the Azure functions:

 import azure.functions as func
 import azure.durable_functions as df
    
    
 def orchestrator_function(context: df.DurableOrchestrationContext):
     result1 = yield context.call_activity('data-collection', None)
     result2 = yield context.call_activity('data-merging', None)
     return [result1, result2]
    
 main = df.Orchestrator.create(orchestrator_function)


I have already tried to manipulate the params of the HTTP Webhook (Timeout duration and number of retries and the number of retries) but always the same problem.

Can any one have any proposition that can help to solve the issue ? thank you in advance guys














azure-webappsazure-functionsazure-logic-apps
metut.png (32.1 KiB)
suggh.png (25.1 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ElAbedHoussemIDT-6342 avatar image
0 Votes"
ElAbedHoussemIDT-6342 answered

Thank you @PRADEEPCHEEKATLA-MSFT for the help to solve this issue.
The solution to avoid blocking the logic app in the call of the HTTP Webhook is to enable asynchronous request-response behavior.
In this case instead to use HTTP Webhook, I used simple HTTP service like the following illustration and every thing works well as wanted :
141680-capddddddture.png




capddddddture.png (14.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

PramodValavala-MSFT avatar image
0 Votes"
PramodValavala-MSFT answered PramodValavala-MSFT commented

@ElAbedHoussemIDT-6342 The HTTP Webhook action requires the callbackUrl to be called to continue. So, you could pass it to the orchestration and call it at the end, similar to how you are calling the other APIs.

Or you could just use the HTTP action instead which polls when it receives a 202 response by enabling asynchronous request-response behavior.


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@PramodValavala-MSFT thank your for your response.
For your second solution :
it's not possible to implement it because this will raise an error directly in the step after calling the HTTP webhook because it uses the output of the HTTP webhook. I am trying to call a durable function using the HTTP webhook, so ASA it receive the request it will return 202 status to the HTTP webhook, than after finishing running, it will return the result associated to the 200 status to the HTTP webhook. then logic app can continue working. So if I use the HTTP action, just after receiving the 202 status it will continue running which will raise an error in the next step. In my case the HTTP webhook is blocked in the "has timed out" status which means in progress.
For your first solution :
I think that I have already implemented the callbackurl by calling the callbackurl function like showed in the this figure. 140518-capturrre.png
If this is incorrect, can you told me please how to fix it

And for your solution : "So, you could pass it to the orchestration and call it at the end, similar to how you are calling the other APIs" what do you mean exactly ? you mean I have to go to the my Orchestrator and add something like this ?:

 result2 = yield context.call_activity('DataPreparationOrchestrator', None)


I think that this create infinite loop. Can you please provide me more explanation with an example to understand you more ? thank you


0 Votes 0 ·
capturrre.png (15.9 KiB)

@ElAbedHoussemIDT-6342 My bad. For solution#2 to work, you need to enable asynchronous request-response behavior. I've updated my answer to include this information.

And for solution#1, you need to call the callbackUrl for Logic Apps to proceed. This is a HTTP POST call (which I referred to as how you call other APIs) that needs to be done at the end of your orchestration instead of returning a value.


1 Vote 1 ·