-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: allow returning none for generic bindings #1379
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit; otherwise LGTM
…-worker into hallvictoria/allow-nill-data
…re/azure-functions-python-worker into hallvictoria/allow-nill-data
4556193
to
b7fbdca
Compare
Codecov ReportAttention: Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.As per 1391, implicit output is enabled for generic types. Therefore, function apps with generic bindings that are also returning None will face an error
TypeError: unable to encode outgoing TypedData: unsupported type "<class 'azure_functions_worker.bindings.generic.GenericBinding'>" for Python type "NoneType"
. This changes the worker to allow this scenario.Fixes #1316
Fixes #1479
PR information
Quality of Code and Contribution Guidelines