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

Python language worker doesn't allow nill data with Dapr Cron Binding Trigger #1316

Closed
ASHIQUEMD opened this issue Sep 17, 2023 · 0 comments · Fixed by #1379
Closed

Python language worker doesn't allow nill data with Dapr Cron Binding Trigger #1316

ASHIQUEMD opened this issue Sep 17, 2023 · 0 comments · Fixed by #1379
Assignees

Comments

@ASHIQUEMD
Copy link

Investigative information

Please provide the following:
  • Timestamp: 2023-09-17T03:40:59.012Z
  • Function App name: functionapp
  • Function name(s) (as appropriate): DaprCronBindingTrigger
  • Core Tools version: 4.0.5312

Repro steps

Provide the steps required to reproduce the problem:

Create an azure function using Python Language and follow the steps mentioned in Readme.

Once you run the app, you will see an exception Exception: AttributeError: 'NoneType' object has no attribute 'type'. This exception occurs at this line in Python language worker.

This azure function app is supposed to be triggered by Dapr cron trigger every 10 second and it should log the message. However, Python language worker expects trigger data in all kinds of trigger. But Dapr cron binding doesn't send any data as part of trigger request, reason being it's a timer trigger.

Expected behavior

Provide a description of the expected behavior.

Python language worker should not expect trigger data in all triggers. In case of Dapr Cron binding trigger, it will not receive any request body, and it is by design from Dapr. Azure function app should get trigger based on the cron expression defined in Dapr cron binding component.

Actual behavior

Provide a description of the actual behavior observed.

Python language worker always expects a request body with trigger, that is not the case with Dapr Cron binding trigger. Dapr Cron binding trigger will simply call the app without any request body, so the data will be nil in this case.

Known workarounds

Provide a description of any known workarounds.

Contents of the requirements.txt file:

Provide the requirements.txt file to help us find out module related issues.
azure-functions

Related information

Provide any related information
# __init__.py

import datetime
import logging
import azure.functions as func

def main(triggerData) -> None:
    logging.info(f"Invoked by Dapr cron binding trigger: Hello, World! The time is {datetime.datetime.now()}")
# requirements.txt
azure-functions
# function.json
{
  "bindings": [
    {
      "type": "daprBindingTrigger",
      "bindingName": "scheduled",
      "name": "triggerData",
      "direction": "in"
    }
  ]
}
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 a pull request may close this issue.

2 participants