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.
[ ] 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.
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 https://github.com/Azure/azure-functions-python-worker/issues/1316 Fixes https://github.com/Azure/azure-functions-python-worker/issues/1479
PR information
Quality of Code and Contribution Guidelines