0

I am currently trying to use oracle API-Gateway & Oracle function to create an API .

It works fine , i got everything working , but the script i am hosting in oracle functions requires asyncio to run , Initially i tried running it with asyncio.run(test_func(test_data))

Initially it just gave a 502 function didn't execute error.

After adding it into try...except and logging the exception i found out there was another loop running so asyncio didn't execute .

So i tried this :

    try:
        loop = asyncio.get_running_loop()
    except Exception as el:  # 'RuntimeError: There is no current event loop...'
        loop = None
        logging.getLogger().info("err "+str(el))

    if loop and loop.is_running():
        try:
            loop.create_task(test_func())
        except Exception as e:
            logging.getLogger().info("err "+str(e))
    else:
        try:
            asyncio.run(test_func())
        except Exception as e:
            logging.getLogger().info("err "+str(e))

Even then it isn't working. Has anyone else faced this error using Oracle Functions with python ? Any Help is appreciated. Non Async Functions run perfectly but async functions don't

Runtime : Python3.8 Environment : fn-project with docker in Oracle Functions

Luke Woodward
  • 63,336
  • 16
  • 89
  • 104
SedLyf
  • 11
  • 3

0 Answers0