azure-functions-python-worker icon indicating copy to clipboard operation
azure-functions-python-worker copied to clipboard

[BUG] Blob Triggers processed blobs on dev server

Open vijaystroup opened this issue 1 year ago • 2 comments

Investigative information

Please provide the following:
  • Timestamp: n/a
  • Function App name: n/a
  • Function name(s) (as appropriate): n/a
  • Core Tools version: 4.0.5455

Repro steps

Provide the steps required to reproduce the problem:
@bp.blob_trigger(
    arg_name='audio',
    path='{x}.wav',
    connection='AzureWebJobsStorage',
)
def trigger(audio: func.InputStream):
    print(audio.name)

func start

Expected behavior

Provide a description of the expected behavior.

The remote, hosted instance of the function app on Azure has already triggered this function for a specific uploaded blob. When I then start the local, dev server, it then again gets triggered as though it has never seen it when it was already processed by the live function app. The expected function is that it does not get triggered since it was already processed by the live function app.

Actual behavior

Provide a description of the actual behavior observed.

Triggers a function for each blob that was uploaded and processed by the live function, that the local server did not process. This is also true of when the live server and local server are both running: the trigger will run twice (which is to be expected, but not the first part of ones that are already processed when the dev server is not running).

Known workarounds

Provide a description of any known workarounds.
@bp.blob_trigger(
    arg_name='audio',
    path='{x}.wav',
    connection='AzureWebJobsStorage',
)
def trigger(audio: func.InputStream):
    # for starting in dev mode, skip if already while dev server was offline
    if check_if_processed_dev(audio.name):
        return

    print(audio.name)

check_if_processed_dev will check the database to see if that file had already been processed in the functionality of my backend.

Contents of the requirements.txt file:

Provide the requirements.txt file to help us find out module related issues.
azure-functions==1.17.0
requests==2.31.0
azure-storage-blob==12.19.0
pyjwt[crypto]==2.8.0
azure-servicebus==7.11.4
azure-cosmos==4.5.1
pydantic==2.5.3
openai==1.4.0
pytz==2023.3.post1

Related information

Provide any related information

n/a

vijaystroup avatar Jan 29 '24 20:01 vijaystroup

Thanks for reporting will check and update.

bhagyshricompany avatar Jan 30 '24 12:01 bhagyshricompany

@gavin-aguiar pls comment and validate.Thanks

bhagyshricompany avatar Feb 26 '24 14:02 bhagyshricompany

if your local.settings.json is naming the local azurite storage emulator for webjobhosts, then this would explain the behaviour observed. Each function receipts the files it has processed inside webjobshosts - that way on restart it can know which files it has already processed and recover any missed blobs. The behaviour described appears to be that the local function and the remote function are either considered different functions (different hashes for some reason) or they are receipting in different accounts. Check what your local.settings.json has setup.

AartBluestoke avatar Jul 28 '25 03:07 AartBluestoke