There is no current event loop in thread 'ThreadPoolExecutor-2_1'."

39 views Asked by At

I am deploying a cloud function to GCP using functions_framework.

I have an asynchronous function that I call with asyncio.run, and I get this error. Can anyone explain why i encounter this and how to solve it ? My setup looks like this

async def task():
    await asyncio.sleep(5)

@functions_framework.cloud_event
def on_event(cloud_event: CloudEvent):
    asyncio.run(task())

0

There are 0 answers