Sarah
Sarah

Reputation: 49

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

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())

Upvotes: 0

Views: 267

Answers (0)

Related Questions