Skip to content
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 path responds with NOT_FOUND. #151

Open
jonasfroeller opened this issue Sep 30, 2024 · 1 comment
Open

Swagger path responds with NOT_FOUND. #151

jonasfroeller opened this issue Sep 30, 2024 · 1 comment

Comments

@jonasfroeller
Copy link
Contributor

jonasfroeller commented Sep 30, 2024

It worked using [email protected] 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",
					},
				},
			},
		}),
    );
@jonasfroeller
Copy link
Contributor Author

jonasfroeller commented Sep 30, 2024

[email protected] is the last version that works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant