Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logic Apps doesn't properly process some HTTP requests with Transfer-Encoding: chunked #869

Closed
hajekj opened this issue Sep 7, 2023 · 5 comments
Labels

Comments

@hajekj
Copy link

hajekj commented Sep 7, 2023

Describe the Bug

I have the following Logic App: /resource/subscriptions/63dd3a98-6ad8-47ae-ae7f-568e9b3104a8/resourcegroups/LogicAppsConsumption/providers/Microsoft.Logic/workflows/case-2307310050002056/designer which is defined as the workflow JSON sample below. The trigger URL is: https://prod-06.westeurope.logic.azure.com:443/workflows/97c8d03a704c44368ca59e64d7ea425b/triggers/manual/paths/invoke?... when sending a HTTP request to this endpoint, it resolves as Traffic Manager and further resolves as either flowfe-prod-am-rp00-app.flow-prod-am-rp00-ase.p.azurewebsites.net (ASE) or flowfe-prod-am-rp.cloudapp.net (Cloud Service) with likely a 1:5 ratio. When I send a standard HTTP POST request from ASP.NET, and the request is routed through Cloud Service, the body is outputted correctly. When the request gets routed through ASE, the body is empty.

Support in the case mentioned below identified the issue here which looks like it has been present since 2016.

  1. Why does it happen only when routed through ASE and not Cloud App?
  2. Is this ever going to be fixed? It looks like only the ASE infrastructure suffers from this, and since Cloud Services as deprecated, you are more likely to break a lot of stuff, since the defaults are to use chunked encoding with HTTP POSTs in C#.

Reference Microsoft Case: #2307310050002056

Plan Type

Consumption

Steps to Reproduce the Bug or Issue

Read the bug description. And execute this from WSL:

Wrong ASE

curl --location 'https://flowfe-prod-am-rp00-app.flow-prod-am-rp00-ase.p.azurewebsites.net/workflows/97c8d03a704c44368ca59e64d7ea425b/triggers/manual/paths/invoke?...' \
--header 'Host: prod-06.westeurope.logic.azure.com' \
--header 'Content-Type: application/json' \
--header 'Transfer-Encoding: chunked' \
--data-raw '{
    "test": true
}'

Works ASE

curl --location 'https://flowfe-prod-am-rp00-app.flow-prod-am-rp00-ase.p.azurewebsites.net/workflows/97c8d03a704c44368ca59e64d7ea425b/triggers/manual/paths/invoke?...' \
--header 'Host: prod-06.westeurope.logic.azure.com' \
--header 'Content-Type: application/json' \
--data-raw '{
    "test": true
}'

Works Cloud Service

curl --location 'https://flowfe-prod-am-rp.cloudapp.net/workflows/97c8d03a704c44368ca59e64d7ea425b/triggers/manual/paths/invoke?...' \
--header 'Host: prod-06.westeurope.logic.azure.com' \
--header 'Content-Type: application/json' \
--header 'Transfer-Encoding: chunked' \
--data-raw '{
    "test": true
}'
curl --location 'https://flowfe-prod-am-rp.cloudapp.net/workflows/97c8d03a704c44368ca59e64d7ea425b/triggers/manual/paths/invoke?...' \
--header 'Host: prod-06.westeurope.logic.azure.com' \
--header 'Content-Type: application/json' \
--data-raw '{
    "test": true
}'

Workflow JSON

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "Response": {
                "inputs": {
                    "body": "@triggerBody()",
                    "statusCode": 200
                },
                "kind": "http",
                "runAfter": {},
                "type": "Response"
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": {},
        "parameters": {},
        "triggers": {
            "manual": {
                "inputs": {
                    "schema": {}
                },
                "kind": "Http",
                "type": "Request"
            }
        }
    },
    "parameters": {}
}

Screenshots or Videos

No response

Additional context

Affects also Power Automate which runs on top of Logic Apps consumption. I removed the trigger URL parameters since it failed to sync to Microsoft's DevOps, however I am happy to provide those for testing.

Partially related to dotnet/runtime#30283 and Stack Overflow providing mitigation.

AB#25096226

@github-actions
Copy link

This issue is stale because it has been open for 45 days with no activity.

@github-actions github-actions bot added the stale label Oct 28, 2023
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

@lbueker
Copy link

lbueker commented Dec 5, 2023

@hajekj Did you find a solution? Facing the same issue.

@hajekj
Copy link
Author

hajekj commented Dec 5, 2023

The solution is to disable chunking on HttpClient side, which can be achieved like this:

var request = new HttpRequestMessage(HttpMethod.Post, "https://...");

// https://github.com/Azure/logicapps/issues/869
var content = JsonContent.Create(body);
await content.LoadIntoBufferAsync();

request.Content = content;

@abatishchev
Copy link
Contributor

+1, nothing works if the request body was chunked and I didn't call LoadIntoBufferAsync().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants