-
Notifications
You must be signed in to change notification settings - Fork 104
'list' object has no attribute 'get_body' in EventHub trigger
Hanzhang Zeng edited this page Jun 22, 2020
·
5 revisions
Some EventHub trigger may have "cardinality"="many" setting in their function.json file, and if the EventHub trigger only handles a single event, this will BREAK.
import azure.functions as func
def main(event: func.EventHubEvent):
Since the event parameter now has a proper list of events, instead of a single event.
In EventHub triggers function.json, change the cardinality to one.
Alternatively, change the EventHub trigger to process multiple events in one go. from
def main(event: func.EventHubEvent):
event.get_body()
to
def main(events: List[func.EventHubEvent]):
for event in events:
event.get_body()