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

Allow nil data for generic bindings

Open hallvictoria opened this issue 2 years ago • 1 comments

Description

Currently, when a function is triggered, the worker expects a request body with the trigger. However, in the case of generic binding types like the Dapr Cron binding trigger, no data is sent with the trigger request. This causes the worker to crash with an exception AttributeError: 'NoneType' object has no attribute 'type'. This fix enables triggers to execute successfully even if the trigger calls the app without any request body.

Fixes https://github.com/Azure/azure-functions-python-worker/issues/1316


PR information

  • [ ] The title of the PR is clear and informative.
  • [ ] There are a small number of commits, each of which has an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, see this page.
  • [ ] If applicable, the PR references the bug/issue that it fixes in the description.
  • [ ] New Unit tests were added for the changes made and CI is passing.

Quality of Code and Contribution Guidelines

hallvictoria avatar Dec 11 '23 21:12 hallvictoria

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 85.46%. Comparing base (7de7724) to head (dff0911). Report is 3 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1379      +/-   ##
==========================================
+ Coverage   85.44%   85.46%   +0.01%     
==========================================
  Files          35       35              
  Lines        1965     1967       +2     
  Branches      370      371       +1     
==========================================
+ Hits         1679     1681       +2     
  Misses        213      213              
  Partials       73       73              
Flag Coverage Δ
unittests 85.40% <100.00%> (+0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Dec 11 '23 21:12 codecov[bot]

Codecov Report

Attention: Patch coverage is 75.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 85.12%. Comparing base (330783f) to head (40c105b). Report is 5 commits behind head on dev.

:exclamation: Current head 40c105b differs from pull request most recent head ca87969. Consider uploading reports for the commit ca87969 to get more accurate results

Files Patch % Lines
azure_functions_worker/bindings/generic.py 66.66% 2 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1379      +/-   ##
==========================================
+ Coverage   84.64%   85.12%   +0.48%     
==========================================
  Files          35       35              
  Lines        2052     2004      -48     
  Branches      387      381       -6     
==========================================
- Hits         1737     1706      -31     
+ Misses        232      223       -9     
+ Partials       83       75       -8     
Flag Coverage Δ
unittests 85.07% <75.00%> (+0.47%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Mar 27 '24 19:03 codecov-commenter