-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(node): Remove deprecated routerPath warning of fastify request object
#13043
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
fix(node): Remove deprecated routerPath warning of fastify request object
#13043
Conversation
|
|
||
| // Taken from Otel Fastify instrumentation: | ||
| // https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/plugins/node/opentelemetry-instrumentation-fastify/src/instrumentation.ts#L94-L96 | ||
| const routeName = reqWithRouteInfo.routeOptions?.url || reqWithRouteInfo.routerPath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks for the PR! Could we do the same change as they did in OTEL:
const routeName = reqWithRouteInfo.routeOptions ? reqWithRouteInfo.routeOptions.url : reqWithRouteInfo.routerPath;Otherwise, this stops working on older fastify versions, I guess, which we do not want!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh i see! So the routerPath is kept for backwards compatibility.
routerPath option of fastify request objectrouterPath warning of fastify request object
|
About the test, we can spyOn/mock the Although the deprecation warning is not logged (when manually tested with the fixed code), I'm stuck at including the case into the test suite. Currently, only the |
We should probably move away from Let's just leave a comment on the test about the deprecation warning not being logged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After we add a comment to the test, and rebase this PR to latest, it's good to go to merge in my eyes.
Thanks for the PR @Zen-cronic (also nice to see some Canadian contributions 🇨🇦)
2bab642 to
8fa3ec6
Compare
Happy to help :) Also I believe my rebase works correctly? Edit: I think I messed up. |
|
assigning myself to help get this merged in! |
| "cors": "^2.8.5", | ||
| "cron": "^3.1.6", | ||
| "express": "^4.17.3", | ||
| "fastify": "~4.23.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future readers - we had to pin this at ~4.23.2 because 4.33+ only works with TS 5, which breaks the rest of our tests 😬
|
Thanks for helping out! |
8525aa8 to
f131c74
Compare
|
@AbhiPrasad can this be merged? |
|
yeah let me rebase and try to get this to the finish line |
|
This is superseded by #15542 - thank you for the effort on this! |
Pull request was closed
Fixes #12844
For the tests, would
dev-packages/node-integration-tests/suitesordev-packages/e2e-tests/test-applications/node-fastifybe a more appropriate location?I also noticed that there's currently no test for fastify in
node-integration.yarn lint) & (yarn test).