-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/swagger/json returning 404 if Swagger is used in conjunction with a prefix set in Elysia #183
Comments
If you’re using Next.js, here’s a temporary solution to address the issue: // src/app/swagger/json/page.tsx
import { redirect } from "next/navigation";
export default function SwaggerPage() {
redirect("/api/swagger/json");
} For a pure Elysia JS project (used as an API only), you can apply the same approach by redirecting the endpoint to |
Thie pr #146 force a path to always start at root instead of relative path, so json file not found when we set a preix in elysia. |
@TheGU my apologies for that. I’ll fix that asap. Thanks! |
Is it really that complicated? |
log:GET /sw.js 404 in 63ms |
When setting a prefix in Elysia and simultaneously using Swagger, it fails to correctly load
/swagger/json
.To reproduce:
Visit the server in a browser
http://localhost:3000/v1/swagger
and you'll be presented with the UI theme of Scalar, but no content.Adding a logger reveals that
/v1/swagger
gets hit and returns a 200 status, immediately followed by/swagger/json
(note the lack of prefix) getting hit with a 404 status.It seems this has been attempted to be fixed before #16 but has remained an ongoing issue since at least October 2024.
The text was updated successfully, but these errors were encountered: