Skip to content

Python runtime does not work on Python 3.12 with ASGI #11545

@kytta

Description

@kytta

Although Python 3.12 is listed as supported by Vercel, it does not work properly with asynchronous functions.

I am trying to deploy a Starlette app (which is ASGI). Just listing Starlette as dependency did not work, as Vercel complained that it's missing aiohttp:

LAMBDA_WARNING: Unhandled exception. [...]
[ERROR] Runtime.ImportModuleError: Unable to import module 'vc__handler__python': No module named 'aiohttp'
Traceback (most recent call last):

So, I've added it to the dependencies (although I don't see the point in it). Nevertheless, it now fails with a different error:

LAMBDA_WARNING: Unhandled exception. [...]
[ERROR] TypeError: Queue.__init__() got an unexpected keyword argument 'loop'
Traceback (most recent call last):
  File "/var/task/vc__handler__python.py", line 305, in vc_handler
    response = asgi_cycle(__vc_module.app, body)
  File "/var/task/vc__handler__python.py", line 202, in __call__
    self.app_queue = asyncio.Queue(loop=loop)

I could trace back to this line of vc_init:

self.app_queue = asyncio.Queue(loop=loop)

According to the Python docs, the loop argument to the Queue was removed in Python 3.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions