question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot import blacksheep.contents. Can't deploy on Vercel

See original GitHub issue

Describe the bug I’m trying to replace my FastAPI apps on Vercel with BlackSheep.

Here is an example: https://github.com/clementpoiret/blacksheep-vercel

Unfortunately, it seems I can’t deploy it, it leads to a server error because:

> Ready! Available at http://0.0.0.0:3000
> Building @vercel/python:server/api.py
Installing required dependencies...
> Built @vercel/python:server/api.py [20s]
Traceback (most recent call last):
  File "/home/cp264607/.cache/com.vercel.fun/runtimes/python3/../python/bootstrap.py", line 147, in <module>
    lambda_runtime_main()
  File "/home/cp264607/.cache/com.vercel.fun/runtimes/python3/../python/bootstrap.py", line 127, in lambda_runtime_main
    fn = lambda_runtime_get_handler()
  File "/home/cp264607/.cache/com.vercel.fun/runtimes/python3/../python/bootstrap.py", line 113, in lambda_runtime_get_handler
    mod = importlib.import_module(module_name)
  File "/home/cp264607/anaconda3/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/tmp/zeit-fun-b57c65a91f69d/vc__handler__python.py", line 12, in <module>
    __vc_spec.loader.exec_module(__vc_module)
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "./server/api.py", line 1, in <module>
    from blacksheep import Application, Content, Response
  File "/tmp/zeit-fun-b57c65a91f69d/blacksheep/__init__.py", line 7, in <module>
    from .contents import Content as Content
ModuleNotFoundError: No module named 'blacksheep.contents'
TypeError: Object prototype may only be an Object or null: undefined
    at Function.setPrototypeOf (<anonymous>)
    at new LambdaError (/usr/lib/node_modules/vercel/dist/index.js:9679:16)
    at Lambda.<anonymous> (/usr/lib/node_modules/vercel/dist/index.js:9812:27)
    at Generator.next (<anonymous>)
    at fulfilled (/usr/lib/node_modules/vercel/dist/index.js:9726:58)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Do you know what is happening? Thanks

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
clementpoiretcommented, Sep 17, 2022

Ohh nice finding! Don’t you think we can open an issue on vercel also? Because if it happens with blacksheep it can also happen for other libs 🤔

0reactions
clementpoiretcommented, Sep 19, 2022

Thanks a lot, you already made awesome progress! I’ll open issues directly for Vercel and reference this one 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · Neoteroi/BlackSheep - GitHub
Contribute to Neoteroi/BlackSheep development by creating an account on GitHub. ... Cannot import blacksheep.contents. Can't deploy on Vercel.
Read more >
Errors – Vercel Docs
A list of errors provided by Vercel CLI or the REST API, with details on how they occur and how to resolve them....
Read more >
How do I resolve a 'module not found' error? - Vercel
The 'module not found' error is a syntax error that appears when the static import statement cannot find the file at the declared...
Read more >
Why aren't commits triggering deployments on Vercel?
You can resolve this from the Git provider side by either granting permissions for all of your repositories, or you can make sure...
Read more >
Troubleshoot a Build – Vercel Docs
This can also be accessed by appending /_src to the Deployment URL; Functions tab - the live console output for Serverless Functions at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found