Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
8.16.0
Framework Version
Fastify 4.25.2
Link to Sentry event
No response
SDK Setup/Reproduction Example
import './instrument.ts';
import Fastify from "fastify";
import * as Sentry from "@sentry/node";
const app = Fastify();
Sentry.setupFastifyErrorHandler(app);
app.listen({ port: 3030 });
Steps to Reproduce
- Set up a standard Fastify server with Fastify tracing
- Access a 404 route that does not exist
Expected Result
No deprecation warnings
Actual Result
The following warning:
[FSTDEP017] DeprecationWarning: You are accessing the deprecated "request.routerPath" property. Use "request.routeOptions.url" instead. Property "req.routerPath" will be removed in fastify@5
.
Caused by this line of code: const routeName = reqWithRouteInfo.routeOptions?.url || reqWithRouteInfo.routerPath;
In 404 errors, routeOptions?.url is undefined so it falls back to routerPath which is deprecated. The OpenTelemetry code that this line was based on has already been fixed in this PR (open-telemetry/opentelemetry-js-contrib@18ae75c#diff-b4262d2d3aefe5f35cfe70e34be5b0bd7324b1623cec94fdf8d2253c9cf9db89R281). Should be a fairly trivial fix - happy to submit a PR as well but not sure what's the best way forward so filing an issue first.
const routeName = reqWithRouteInfo.routeOptions ? reqWithRouteInfo.routeOptions.url : reqWithRouteInfo.routerPath;
Metadata
Metadata
Assignees
Type
Projects
Status