I have created a function with an Event Hub Trigger. It has been working as expected until today.
import logging
import datetime
import json
import azure.functions as func
def main(event: func.EventHubEvent, msg: func.Out[func.QueueMessage]):
try:
# take the number from the event
number = json.loads(event.get_body().decode('utf-8'))[0]["number"]
# send number to queue
msg.set(number)
logging.info('Receive function processed ' + number + '.')
except Exception as err:
logging.error('Event hub message did not contain number. Error: ' + str(err))
The function is raising an error
Event hub message did not contain number. Error: 'list' object has no attribute 'get_body'
and I can see traces in the logs in Application Insights that contain the message:
An Event Hub exception of type 'ReceiverDisconnectedException' was thrown from Partition Id: '0'. This exception type is typically a result of Event Hub processor rebalancing and can be safely ignored
When I run the function locally with VS code, it is able to read the messages from event hubs.
Any idea why it's stopped working?