1

my blob storage function logic is very straightforward, whenever an image is uploaded to a container (in the test envrionment), the function gets hit and send a notification to third party. I noticed everytime I run the function locally (pointing to the storage account that the container stays in test envrionemnt), the function gets triggered, and processes ALL images available in the container. After processing all of them, then it works as expected: only gets hit whenever I uploaded a new image inside. If I stop the function, re-run it in a short time, it only processes the updated one as expected too. Only the first time run (like a code start), all files get processed. Example: I didn't expect files in below list modified on 3/16 or 3/7 to get procssed, but they hit the blob trigger function as well.

enter image description here I feel it works how we test locally, since the func running locally doesn't know which one is the updated one first time? But would like to check around whoever has the similar experience ...thanks!

1 Answers1

1

I feel it works how we test locally, since the func running locally doesn't know which one is the updated one first time?

This is an expected behavior seen in Azure function Blob or event triggers. AFAIK, this behavior seen in 2 cases.

Reason -1 (Blob is getting updated when function isn't running)

You probably might have updated the blobs of 3/6 and 3/7 while the function isn't running. So, when you rerun the function on 3/17, those blobs got triggered too.

Reason -2 (Missing checkpoint)

The details of checkpoint might got lost as the function store the current checkpoint for every run having the details of the blobs that are processed.

  • Since you are running the function locally, you can find the blobs that are process in the local storage emulator by navigating to Your emulator >> azure-webjob-hosts >> blobreceipts >> < Checkpoint File> >> < FunctionApp>.< FunctionName>.Run/.

    enter image description here

  • The same follows when the function is in portal except for the part where the checkpoint file is stored in the concerned storage account.

  • Once you delete those files and re-run the function, it is going to trigger for the three files though they got already triggered before. This is the same reason why you see that multiple blobs are getting triggered when the function runs for the first time (No checkpoint set in local emulator).

SwethaKandikonda
  • 7,513
  • 2
  • 4
  • 18