Skip to content
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 #1482

Merged
merged 1 commit into from
Apr 18, 2024

Conversation

hallvictoria
Copy link
Contributor

@hallvictoria hallvictoria commented Apr 18, 2024

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

  • 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 hallvictoria changed the base branch from release/4.27.1 to release/4.27.2 April 18, 2024 16:35
@hallvictoria hallvictoria marked this pull request as ready for review April 18, 2024 16:35
@gavin-aguiar gavin-aguiar merged commit 3c0f473 into release/4.27.2 Apr 18, 2024
45 of 47 checks passed
@gavin-aguiar gavin-aguiar deleted the hallvictoria-hotfix-4272 branch April 18, 2024 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants