Logic App not working for large sized files even with chunking

Sandeep Kumar Mahala 1 Reputation point
2021-05-26T14:12:25.637+00:00

I am try to set a logic app to copy data from sharepoint folder to azure blob storage.

Below are the connector setup

  • A sharepoint connector "When a file is create or modified" mapped to a sharepoint folder
  • HTTP connector to Microsoft Graph endpoint. HTTP connector then return 302 response with Location property in header.
  • A switch case to handle 302
  • Another HTTP connector inside switch case 302, Location property from above HTTP is used as URL of this HTTP call to get file content
  • Create blob connector create the file in blob storage container

For some files, it is working but for some files first HTTP returns 404 response code, which is inconsistent 99829-404-error.png99868-output.png

Below is the logic app code

{  
    "definition": {  
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",  
        "actions": {  
            "Create_blob": {  
                "inputs": {  
                    "body": "@body('HTTP_4')",  
                    "host": {  
                        "connection": {  
                            "name": "@parameters('$connections')['azureblob']['connectionId']"  
                        }  
                    },  
                    "method": "post",  
                    "path": "/datasets/default/files",  
                    "queries": {  
                        "folderPath": "/teamstoblob",  
                        "name": "@triggerBody()?['{FilenameWithExtension}']",  
                        "queryParametersSingleEncoded": true  
                    }  
                },  
                "runAfter": {  
                    "Switch": [  
                        "Succeeded"  
                    ]  
                },  
                "runtimeConfiguration": {  
                    "contentTransfer": {  
                        "transferMode": "Chunked"  
                    }  
                },  
                "type": "ApiConnection"  
            },  
            "Delay": {  
                "inputs": {  
                    "interval": {  
                        "count": 2,  
                        "unit": "Minute"  
                    }  
                },  
                "runAfter": {},  
                "type": "Wait"  
            },  
            "HTTP_3": {  
                "inputs": {  
                    "authentication": {  
                        "audience": "https://graph.microsoft.com",  
                        "clientId": "XXXXXXXXXXXXXXX",  
                        "secret": "XXXXXXXXXXXXXXXXXXXXX",  
                        "tenant": "XXXXXXXXXXXXXXXXXXXX",  
                        "type": "ActiveDirectoryOAuth"  
                    },  
                    "method": "GET",  
                    "uri": "https://graph.microsoft.com/v1.0/groups/2XXXXXXXXXXXXXXXX/drive/root:/General/@{triggerBody()?['{FilenameWithExtension}']}:/content"  
                },  
                "runAfter": {  
                    "Delay": [  
                        "Succeeded"  
                    ]  
                },  
                "runtimeConfiguration": {  
                    "contentTransfer": {  
                        "transferMode": "Chunked"  
                    }  
                },  
                "type": "Http"  
            },  
            "Post_a_message_(V3)": {  
                "inputs": {  
                    "body": {  
                        "body": {  
                            "content": "<p>Fialed to upload file . Please try again.&nbsp;</p>",  
                            "contentType": "html"  
                        },  
                        "subject": "File upload failed"  
                    },  
                    "host": {  
                        "connection": {  
                            "name": "@parameters('$connections')['teams']['connectionId']"  
                        }  
                    },  
                    "method": "post",  
                    "path": "/v3/beta/teams/@{encodeURIComponent('22fe8287-XXXXXXXXXXXX-bdf8739800d9')}/channels/@{encodeURIComponent('19:6e5ba935XXXXXXXXXXXXXXXXX63d8@thread.tacv2')}/messages"  
                },  
                "runAfter": {  
                    "Create_blob": [  
                        "Failed"  
                    ]  
                },  
                "type": "ApiConnection"  
            },  
            "Switch": {  
                "cases": {  
                    "Case": {  
                        "actions": {  
                            "HTTP_4": {  
                                "inputs": {  
                                    "headers": {  
                                        "Range": "bytes=0-104857599"  
                                    },  
                                    "method": "GET",  
                                    "uri": "@body('Parse_JSON')?['Location']"  
                                },  
                                "runAfter": {  
                                    "Parse_JSON": [  
                                        "Succeeded"  
                                    ]  
                                },  
                                "runtimeConfiguration": {  
                                    "contentTransfer": {  
                                        "transferMode": "Chunked"  
                                    }  
                                },  
                                "type": "Http"  
                            },  
                            "Parse_JSON": {  
                                "inputs": {  
                                    "content": "@outputs('HTTP_3')['headers']",  
                                    "schema": {  
                                        "properties": {  
                                            "Cache-Control": {  
                                                "type": "string"  
                                            },  
                                            "Content-Length": {  
                                                "type": "string"  
                                            },  
                                            "Date": {  
                                                "type": "string"  
                                            },  
                                            "Location": {  
                                                "type": "string"  
                                            },  
                                            "Strict-Transport-Security": {  
                                                "type": "string"  
                                            },  
                                            "Transfer-Encoding": {  
                                                "type": "string"  
                                            },  
                                            "client-request-id": {  
                                                "type": "string"  
                                            },  
                                            "request-id": {  
                                                "type": "string"  
                                            },  
                                            "x-ms-ags-diagnostic": {  
                                                "type": "string"  
                                            }  
                                        },  
                                        "type": "object"  
                                    }  
                                },  
                                "runAfter": {},  
                                "type": "ParseJson"  
                            }  
                        },  
                        "case": 302  
                    }  
                },  
                "default": {  
                    "actions": {}  
                },  
                "expression": "@outputs('HTTP_3')['statusCode']",  
                "runAfter": {  
                    "HTTP_3": [  
                        "Failed"  
                    ]  
                },  
                "type": "Switch"  
            }  
        },  
        "contentVersion": "1.0.0.0",  
        "outputs": {},  
        "parameters": {  
            "$connections": {  
                "defaultValue": {},  
                "type": "Object"  
            }  
        },  
        "triggers": {  
            "When_a_file_is_created_or_modified_(properties_only)": {  
                "inputs": {  
                    "host": {  
                        "connection": {  
                            "name": "@parameters('$connections')['sharepointonline']['connectionId']"  
                        }  
                    },  
                    "method": "get",  
                    "path": "/datasets/@{encodeURIComponent(encodeURIComponent('https://XXXXXXXXXXXXXX/sites/BatchProcessing'))}/tables/@{encodeURIComponent(encodeURIComponent('6f158788-XXXXXXXXXXXXXX-9e53a1838da1'))}/onupdatedfileitems",  
                    "queries": {  
                        "folderPath": "/Shared Documents/General/Batch Doc Upload"  
                    }  
                },  
                "recurrence": {  
                    "frequency": "Second",  
                    "interval": 30  
                },  
                "splitOn": "@triggerBody()?['value']",  
                "type": "ApiConnection"  
            }  
        }  
    },  
    "parameters": {  
        "$connections": {  
            "value": {  
                "azureblob": {  
                    "connectionId": "/subscriptions/e2691b7e-XXXXXXXXXXXXXXXXX-0b55fb638d4a/resourceGroups/RD-XXXXXXXXXXXXesources-DevTest/providers/Microsoft.Web/connections/azureblob-8",  
                    "connectionName": "azureblob-8",  
                    "id": "/subscriptions/e2691b7e-XXXXXXXXXXXXXX-0b55fb638d4a/providers/Microsoft.Web/locations/eastus/managedApis/azureblob"  
                },  
                "sharepointonline": {  
                    "connectionId": "/subscriptions/e2691b7e-XXXXXXXXXXXXX-0b55fb638d4a/resourceGroups/RD-XXXXXXXXXXXXXesources-DevTest/providers/Microsoft.Web/connections/sharepointonline-1",  
                    "connectionName": "sharepointonline-1",  
                    "id": "/subscriptions/e2691b7e-XXXXXXXXXX-0b55fb638d4a/providers/Microsoft.Web/locations/eastus/managedApis/sharepointonline"  
                },  
                "teams": {  
                    "connectionId": "/subscriptions/e2691b7e-XXXXXXXXXXXXXX-0b55fb638d4a/resourceGroups/RD-RDTechIA-AppResources-DevTest/providers/Microsoft.Web/connections/teams",  
                    "connectionName": "teams",  
                    "id": "/subscriptions/e2691b7e-XXXXXXXXXXX-0b55fb638d4a/providers/Microsoft.Web/locations/eastus/managedApis/teams"  
                }  
            }  
        }  
    }  
}  
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,717 questions
{count} votes

1 answer

Sort by: Most helpful
  1. JayaC-MSFT 5,511 Reputation points
    2021-06-29T06:24:28.68+00:00

    Hello @Sandeep Kumar Mahala , I am unable to replicate at my end. Hence if you are still encountering the issue I would request you to send an email with subject line “Attn:Jaya” to AzCommunity[at]Microsoft[dot]com referencing this thread along with the subscription id.
    You may also try azure function in between, as a work around : https://sharepoint.stackexchange.com/questions/275091/upload-large-files-from-sharepoint-to-azure-blob
    However, I see this : User Voice as well.

    0 comments No comments