-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Route path URL is undefined #40
Comments
I'm also having this issue since upgrading to Elysia 1.2 from 1.1. I'm using Sentry as my tracing backend. |
@askareija I've noticed in my Elysia server that the routes in my traces are defined once I place my I think there's some sort of interaction occurring between the EDIT: After thinking about it a bit more, there is likely an interaction occurring between |
OK thanks for the info, i've tried to move opentelemetry plugin before cors, and try to disable my swagger plugin but it's still didn't work. still got undefined. |
i make it working by calling "route" property. Steps like this: Create a logging middleware and run it on import Elysia from 'elysia';
import { logger } from '../logger';
import { record } from '@elysiajs/opentelemetry';
const loggingMiddleware = new Elysia().onAfterResponse(
{ as: 'scoped' },
({ request, set, server, path, route }) => {
record('middleware.logging.log_request', () => {
const status = set.status as number;
console.log("Route: ", route);
const ip_address = server?.requestIP(request)?.address;
logger[status >= 400 ? 'error' : 'info'](
{ ip_address },
`${request.method}: ${path} - ${set.status}`,
);
});
},
);
export default loggingMiddleware; and then call it in main instance: const app = new Elysia({
precompile: true,
})
// SECTION: Middleware sections
.use(
cors({
methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'],
origin: ALLOWED_ORIGINS,
}),
)
.use(otelMiddleware)
.use(loggingMiddleware)
// !SECTION
// SECTION: Import controller dengan lazy loading
.use(import('../users/user_controller'))
.get('/roles', () => "Roles route.")
if (!IS_PRODUCTION) {
app.use(swagger());
}
export default app; Yea i'm using As you can see from the picture below, route path is now defined and even i see the " |
Cool!, looks like work around for this is injecting attributes on after response 🥴 |
What version of Elysia is running?
1.2.10
What platform is your computer?
Linux 6.9.3-76060903-generic x86_64 unknown
What steps can reproduce the bug?
What is the expected behavior?
route path is not undefined.
What do you see instead?
Additional information
Packages installed:
Opentelemetry middleware:
Main elysia:
usersController:
Have you try removing the
node_modules
andbun.lockb
and try again yet?yes
The text was updated successfully, but these errors were encountered: