Anyone have any luck getting the Automation API wo...
# automation-api
b
Anyone have any luck getting the Automation API working behind a Python API framework like FastAPI or Django? I'm trying to front my automation script with FastAPI but I'm getting an error about loops from the Pulumi runtime:
Copy code
@ previewing update.....
 +  pulumi:pulumi:Stack CL1004-simple-app-dev create
@ previewing update....
 +  pulumi:pulumi:Stack CL1004-simple-app-dev create error: python inline source runtime error: 'Loop' object has no attribute '_ready'
 +  pulumi:pulumi:Stack CL1004-simple-app-dev create error: an unhandled error occurred: python inline source runtime error: 'Loop' object has no attribute '_ready'
 +  pulumi:pulumi:Stack CL1004-simple-app-dev create 2 errors
Diagnostics:
  pulumi:pulumi:Stack (CL1004-simple-app-dev):
    error: python inline source runtime error: 'Loop' object has no attribute '_ready'
    Traceback (most recent call last):
      File "/home/nathanu/dev/simple-api-pulumi/venv/lib/python3.12/site-packages/pulumi/automation/_server.py", line 80, in run
        loop.run_until_complete(run_in_stack(self.program))
      File "uvloop/loop.pyx", line 1518, in uvloop.loop.Loop.run_until_complete
      File "/home/nathanu/dev/simple-api-pulumi/venv/lib/python3.12/site-packages/pulumi/runtime/stack.py", line 145, in run_in_stack
        await run_pulumi_func(run)
      File "/home/nathanu/dev/simple-api-pulumi/venv/lib/python3.12/site-packages/pulumi/runtime/stack.py", line 55, in run_pulumi_func
        func()
      File "/home/nathanu/dev/simple-api-pulumi/venv/lib/python3.12/site-packages/pulumi/runtime/stack.py", line 142, in run
        Stack(func)
      File "/home/nathanu/dev/simple-api-pulumi/venv/lib/python3.12/site-packages/pulumi/runtime/stack.py", line 171, in __init__
        awaitable = func()
                    ^^^^^^
      File "/home/nathanu/dev/simple-api-pulumi/app/main.py", line 24, in pulumi_program
        default_vpc = aws.ec2.get_vpc(id=vpcID)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/nathanu/dev/simple-api-pulumi/venv/lib/python3.12/site-packages/pulumi_aws/ec2/get_vpc.py", line 290, in get_vpc
        __ret__ = pulumi.runtime.invoke('aws:ec2/getVpc:getVpc', __args__, opts=opts, typ=GetVpcResult).value
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/nathanu/dev/simple-api-pulumi/venv/lib/python3.12/site-packages/pulumi/runtime/invoke.py", line 128, in invoke
        return _sync_await(awaitableInvokeResult)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/nathanu/dev/simple-api-pulumi/venv/lib/python3.12/site-packages/pulumi/runtime/sync_await.py", line 49, in _sync_await
        ntodo = len(loop._ready)  # type: ignore
                    ^^^^^^^^^^^
    AttributeError: 'Loop' object has no attribute '_ready'
r
I've done this with flask but never django or fastapi
b
I'll change over to Flask and give it a try. Thanks!