digitros / nextjs-fastapi

https://nextjs-fastapi-starter.vercel.app
MIT License
408 stars 117 forks source link

Swagger UI and openapi.json not available in Vercel Deployments #12

Open ifjorissen opened 10 months ago

ifjorissen commented 10 months ago

Check the live demo-- https://nextjs-fastapi-starter.vercel.app/

According to next.config.js, the swagger UI should be at https://nextjs-fastapi-starter.vercel.app/docs, and the openapi.json at https://nextjs-fastapi-starter.vercel.app/openapi.json

However, both of those 404.

Have cloned this project locally & deployed it to vercel and can confirm I see the same behavior.

Any ideas on how to get the swagger ui and openapi.json to route correctly? Thanks!

LennardSchwarz commented 9 months ago

https://github.com/digitros/nextjs-fastapi/pull/9/files

Have you tried mapping the docs to the correct url while instantiating FastAPI like in this PR?

riziles commented 8 months ago

@ifjorissen , If you have simply cloned this repo or clicked the "Deploy to Vercel" button, I believe the next.config.js is currently configured to only deploy the Swagger UI if process.env.NODE_ENV === "development" which is not the case in a production Vercel deployment.