azureazure-functionsazure-blob-storageblobazure-blob-trigger

Blob Trigger Azure Function v1 failing to process only one blob at a time


Here's all I've tried to try and stop the parallel processing:

  1. host.JSON file looks like this:
"version": "2.0",
"extensions": {
    "queues": {
      "batchSize": 1,
      "maxDequeueCount": 1,
      "newBatchThreshold": 0
    }
  1. I've scaled down my Function App through the portal:

enter image description here

  1. I've added an Application Setting to my function app and set it to 1 WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT: 1

enter image description here

  1. Executed this statement with the proper credentials with Azure CLI:
az resource update --resource-type Microsoft.Web/sites -g <RESOURCE_GROUP> -n <FUNCTION_APP-NAME>/config/web --set properties.functionAppScaleLimit=<SCALE_LIMIT>

Even still, blobs that are uploaded the same time are processed at the same time. I would like to process the next blob only after the first one has finished. Anything else I could try?


Solution

  • You are using a blob triggered function but your host.json has the queue extension. Try using the blob extension and set the maxDegreeParallelism to 1 as shown below.

    The queue extension will only impact if you are using queue triggered functions. Even if blobs do use a queue in the background, the queue extension is only for queue triggers and the blob extension is for blob triggers. Else we wouldn't need 2 different extensions. I suggest removing the queue extension to avoid confusion. You can always add it again if needed. Your blob extension will look like this.

    {"version":"2.0", "extensions": { "blobs": { "maxDegreeParallelism" : 1 }}}