Skip to content

feat(nextjs): Add method and url to route handler request data #14084

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

Merged
merged 4 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ test('Should record exceptions and transactions for faulty route handlers', asyn

expect(routehandlerError.exception?.values?.[0].value).toBe('route-handler-error');

expect(routehandlerError.request?.method).toBe('PUT');
expect(routehandlerError.request?.url).toContain('/route-handlers/[param]/error');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what we really need here is the unparameterized url. Which is a major pain in the butt to grab in Next.js because it turns static routes dynamic 🤔 Let me sit on this a bit.


expect(routehandlerError.transaction).toBe('PUT /route-handlers/[param]/error');
});

Expand Down
2 changes: 2 additions & 0 deletions packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export function wrapRouteHandlerWithSentry<F extends (...args: any[]) => any>(

isolationScope.setSDKProcessingMetadata({
request: {
url: parameterizedRoute,
method,
headers: completeHeadersDict,
},
});
Expand Down
Loading