-
Notifications
You must be signed in to change notification settings - Fork 16
Closed
Description
Description
When the FastAPI app object is returned by a method instead of constructed in place, the extension fails to load the FastAPI app. The extension is partly discovering the app (see logs 2026-03-03 22:18:16.xxx), it founds 2 routes but no routers. Above approach where the FastAPI object is returned by a method works fine with fastapi run. The entry point is set via pyproject.toml (and also picked up and used by fastapi run).
When I construct the FastAPI object in place the extension successfully finds the app (see logs 2026-03-03 22:18:48.xxx, it founds 2 routes and 1 router).
See also the attached reproducer: reproducer.zip
Extension logs
2026-03-03 22:18:16.178 [info] Discovering FastAPI apps in 1 workspace folder(s)...
2026-03-03 22:18:16.209 [info] Analyzed "file:///Users/<username>/reproducer/main.py": 2 routes, 0 routers, 0 include_router calls
2026-03-03 22:18:16.210 [info] No FastAPI apps found in workspace
2026-03-03 22:18:48.736 [info] Discovering FastAPI apps in 1 workspace folder(s)...
2026-03-03 22:18:48.757 [info] Analyzed "file:///Users/<username>/reproducer/main.py": 2 routes, 1 routers, 0 include_router calls
2026-03-03 22:18:48.757 [info] Found 1 FastAPI app(s) with 2 route(s) in reproducer
Repository link (if open source)
No response
Project structure
reproducer
├- app.py
├- main.py
├- poetry.lock
└- pyproject.toml
FastAPI app and router setup
Direct via @app.get("/path") in `main.py` file.pyproject.toml [tool.fastapi] section (if present)
[tool.fastapi]
entrypoint = "main:app"VS Code version
1.109.5
FastAPI extension version
0.1.2
Python version
3.14.3
FastAPI version
0.135.1
Operating system
MacOS 26.3
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working