FastApi Python swagger always returns blank page starlette 0.27.0 #10752
-
First Check
Commit to Help
Example Codeimport os
from typing import Annotated
from fastapi.responses import JSONResponse
from fastapi import FastAPI
from typing import Union
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/something")
async def something():
return {"message": "Hello World"}DescriptionI already checked, this is not a duplicate, this is happening with Swagger is giving me a blank page when running. Everything looks fine on the bakcend This happens with docker and without it import os
from typing import Annotated
from fastapi.responses import JSONResponse
from fastapi import FastAPI
from typing import Union
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/something")
async def something():
return {"message": "Hello World"}```Running: Error in console when going to /docs is: I will post this on github as well to let the devs of Swagger know, just wanted to do a sanity check Any ideas? Operating SystemWindows Operating System DetailsLinux and windows FastAPI Version0.104.1 Pydantic Version2.5.2 Python Version3.10 and 3.12 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
I'm using MacOS and couldn't reproduce. Maybe it's something related to your environment. It seems you are not able to access the CDN files to generate the Swagger UI. Check your connection to the internet or download the static swagger-ui-bundle files as showed on the FastAPI documentation: https://fastapi.tiangolo.com/how-to/custom-docs-ui-assets/. |
Beta Was this translation helpful? Give feedback.


I'm using MacOS and couldn't reproduce. Maybe it's something related to your environment. It seems you are not able to access the CDN files to generate the Swagger UI. Check your connection to the internet or download the static swagger-ui-bundle files as showed on the FastAPI documentation: https://fastapi.tiangolo.com/how-to/custom-docs-ui-assets/.