Skip to content

Swagger path responds with NOT_FOUND.Β #151

Open
@jonasfroeller

Description

It worked using elysia@1.0.15 and @elysiajs/swagger@^1.0.2.
I tried removing my swagger configuration and checked out the default /swagger path. Same issue.
I upgraded bun, deleted node_modules and reinstalled them. Same issue.
I also tried removing every other path and plugin and just adding swagger. Same issue.
I am so confused. Did something change in elysiajs, that breaks my code now?

My dependencies:

  "dependencies": {
    "@apollo/client": "^3.11.8",
    "@bogeychan/elysia-logger": "^0.1.4",
    "@elysiajs/bearer": "^1.1.2",
    "@elysiajs/cors": "^1.1.1",
    "@elysiajs/html": "^1.1.1",
    "@elysiajs/jwt": "^1.1.1",
    "@elysiajs/static": "^1.1.1",
    "@elysiajs/swagger": "^1.1.3",
    "@octokit/graphql-schema": "^15.25.0",
    "drizzle-orm": "^0.33.0",
    "elysia": "^1.1.17",
    "graphql": "^16.9.0",
    "octokit": "^4.0.2",
    "pg": "^8.13.0"
  },
  "devDependencies": {
    "@biomejs/biome": "^1.9.2",
    "@octokit/types": "^13.6.0",
    "@types/html-validator": "^5.0.6",
    "@types/pg": "^8.11.10",
    "bun-types": "^1.1.29",
    "drizzle-kit": "^0.24.2",
    "html-validator": "^6.0.1"
  },

Old dependencies:

  "dependencies": {
    "@bogeychan/elysia-logger": "^0.0.20",
    "@elysiajs/bearer": "^1.0.2",
    "@elysiajs/cors": "^1.0.2",
    "@elysiajs/html": "^1.0.2",
    "@elysiajs/jwt": "^1.0.2",
    "@elysiajs/static": "^1.0.2",
    "@elysiajs/swagger": "^1.0.2",
    "@octokit/graphql-schema": "^14.47.1",
    "drizzle-orm": "^0.30.9",
    "elysia": "^1.0.9",
    "octokit": "^3.1.2",
    "pg": "^8.11.5"
  },
  "devDependencies": {
    "@biomejs/biome": "^1.6.1",
    "@octokit/types": "^12.6.0",
    "@types/html-validator": "^5.0.6",
    "@types/pg": "^8.11.5",
    "bun-types": "^1.0.33",
    "drizzle-kit": "^0.20.17",
    "html-validator": "^6.0.1"
  },

My code:

export const app = new Elysia()
	.use(logger({ autoLogging: true }))
	.use(
		staticPlugin({
			assets: "static",
			prefix: "/",
		}),
	)
	.use(
		cors({
			origin: CORS_ORIGINS,
		}),
	)
	.use(html())
	.use(ROOT_ROUTES)

	// VERSIONS
	.use(API_FORWARD_ROUTES)
	.group(SWAGGER_PATH, (app) =>
		app
			.get("", async ({ redirect }) => {
				return redirect(`/${LATEST_SWAGGER_PATH}`);
			})
			.get(
				"/json",
				async ({ redirect }) => {
					return redirect(`/${LATEST_SWAGGER_PATH}/json`);
				},
			),
	)
	.use(v1)
	.listen(PORT);

v1:

export const v1 = new Elysia({ prefix: `/${V1_PATH}` })
	.group("/xxx", (app) =>
		app
			.use(XXX)
	)
	.use(
		swagger({
			scalarVersion: "1.25.24",
			path: SWAGGER_PATH,
			exclude: [
				...ROOT_PATHS,
				...SWAGGER_PATH_EXCLUDE,
				new RegExp("(/github/webhooks/)[A-Za-z/{_}]*"),
			],
			scalarConfig: {
				metaData: {
					ogImage: {
						url: "http://localhost:3000/favicon.png",
						secureUrl: "https://xxx.com/favicon.png",
						type: "image/png",
						width: 512,
						height: 512,
						alt: "favicon",
					},
				},
			},
		}),
    );

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions