Azure / azure-functions-python-worker

Python worker for Azure Functions.
http://aka.ms/azurefunctions
MIT License
331 stars 100 forks source link

[BUG] Blob Triggers processed blobs on dev server #1412

Open vijaystroup opened 5 months ago

vijaystroup commented 5 months ago

Investigative information

Please provide the following:

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

bhagyshricompany commented 5 months ago

Thanks for reporting will check and update.

bhagyshricompany commented 4 months ago

@gavin-aguiar pls comment and validate.Thanks