Forum Discussion
Not able to Fetch events from event-hub when deployed in azure functions
It is succesfully executed in local machine but while deploying the same to azure functions getting the error :-
Result: Failure Exception: RuntimeError: There is no current event loop in thread 'ThreadPoolExecutor-1_0'. Stack: File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/dispatcher.py", line 458, in _handle__invocation_request call_result = await self._loop.run_in_executor( File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/dispatcher.py", line 701, in _run_sync_func return ExtensionManager.get_sync_invocation_wrapper(context, File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/extension.py", line 215, in _raw_invocation_wrapper result = function(**args) File "/home/site/wwwroot/O365_function/__init__.py", line 204, in main event_obj.start_event() File "/home/site/wwwroot/O365_function/__init__.py", line 189, in start_event auth_client = self.auth_client() File "/home/site/wwwroot/O365_function/__init__.py", line 105, in auth_client client = EventHubConsumerClient.from_connection_string( File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/eventhub/aio/_consumer_client_async.py", line 335, in from_connection_string return cls(**constructor_args) File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/eventhub/aio/_consumer_client_async.py", line 181, in __init__ self._lock = asyncio.Lock(**self._internal_kwargs) File "/usr/local/lib/python3.9/asyncio/locks.py", line 81, in __init__ self._loop = events.get_event_loop() File "/usr/local/lib/python3.9/asyncio/events.py", line 642, in get_event_loop raise RuntimeError('There is no current event loop in thread %r.'
Can anyone suggest what am i missing ? Also attaching the sample code for reference