vercel / vercel/examples

Sonic example doesn't work

Open
#873 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5.2k
Forks
1.8k
Avg merge
3d 12h
Merged PRs (30d)
6

Description

I'm following the steps of https://vercel.com/docs/functions/runtimes/python#asynchronous-server-gateway-interface but vercel dev prints:

> Built @vercel/python@latest:api/index.py [7s]
Traceback (most recent call last):
  File "/Users/okonet/Library/Caches/com.vercel.fun/runtimes/python3/../python/bootstrap.py", line 147, in <module>
    lambda_runtime_main()
  File "/Users/okonet/Library/Caches/com.vercel.fun/runtimes/python3/../python/bootstrap.py", line 127, in lambda_runtime_main
    fn = lambda_runtime_get_handler()
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/okonet/Library/Caches/com.vercel.fun/runtimes/python3/../python/bootstrap.py", line 113, in lambda_runtime_get_handler
    mod = importlib.import_module(module_name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/var/folders/8z/jnh1lm1j6_vbhbc66cyrp3zw0000gn/T/zeit-fun-677899ef016b6/vc__handler__python.py", line 13, in <module>
    __vc_spec.loader.exec_module(__vc_module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/private/var/folders/8z/jnh1lm1j6_vbhbc66cyrp3zw0000gn/T/zeit-fun-677899ef016b6/./api/index.py", line 1, in <module>
    from sanic import Sanic
  File "/var/folders/8z/jnh1lm1j6_vbhbc66cyrp3zw0000gn/T/zeit-fun-677899ef016b6/sanic/__init__.py", line 1, in <module>
    from sanic.app import Sanic
  File "/var/folders/8z/jnh1lm1j6_vbhbc66cyrp3zw0000gn/T/zeit-fun-677899ef016b6/sanic/app.py", line 18, in <module>
    from sanic.asgi import ASGIApp
  File "/var/folders/8z/jnh1lm1j6_vbhbc66cyrp3zw0000gn/T/zeit-fun-677899ef016b6/sanic/asgi.py", line 13, in <module>
    from sanic.request import Request
  File "/var/folders/8z/jnh1lm1j6_vbhbc66cyrp3zw0000gn/T/zeit-fun-677899ef016b6/sanic/request.py", line 12, in <module>
    from httptools import parse_url
  File "/var/folders/8z/jnh1lm1j6_vbhbc66cyrp3zw0000gn/T/zeit-fun-677899ef016b6/httptools/__init__.py", line 1, in <module>
    from . import parser
  File "/var/folders/8z/jnh1lm1j6_vbhbc66cyrp3zw0000gn/T/zeit-fun-677899ef016b6/httptools/parser/__init__.py", line 1, in <module>
    from .parser import *  # NoQA
    ^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'httptools.parser.parser'
LambdaError: RequestId: 8320c3a8-dde2-4116-ac93-7f77e3396e24 Process exited before completing request
    at Lambda.<anonymous> (/Users/okonet/.fnm/node-versions/v18.18.2/installation/lib/node_modules/vercel/node_modules/@vercel/fun/dist/src/index.js:110:27)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/okonet/.fnm/node-versions/v18.18.2/installation/lib/node_modules/vercel/node_modules/@vercel/fun/dist/src/index.js:24:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the asynchronous server gateway interface example in the linked documentation and its api/index.py entry point. Reproduce the failure with vercel dev and inspect the reported httptools.parser.parser import error. Done means the documented example starts successfully without the ModuleNotFoundError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.