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 log "Blob Size: None" when triggered #1453

Open hossam-nasr opened 3 months ago

hossam-nasr commented 3 months ago

Investigative information

Func version: 4.0.5390 Python version: 3.10.11 Extension bundle: v4 Repros with both programming model V1 & V2

Repro steps

  1. Create a Python Functions project
  2. Create a blob trigger function (use default template), listening to blobs on the samples-workitems container in the local emulator
  3. Execute your function using F5 on VSCode or running func start
  4. Trigger your function by uploading any blob to the samples-workitems container in the emulator
  5. Check output log

Expected behavior

Show the correct blob size in the output log: image

Actual behavior

The blob size is "None bytes" in the output log:

image

Known workarounds

The default template for blob triggers logs the size of the blob using myblob.length. I tried manually debugging the function, and saw that in my one example, using instead myblob.blob_properties['ContentLength'] to log the blob length worked. I'm not sure if that's always set or a reliable property though. Also not sure if this is a Python worker issue that it doesn't properly set the myblob.length property, or a templates issue that it shouldn't rely on the myblob.length property to begin with.

Contents of the requirements.txt file:

azure-functions

Related information

From https://github.com/microsoft/vscode-azurefunctions/issues/4051

bhagyshricompany commented 3 months ago

Hi @hossam-nasr thanks for reporting will check and update.