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

fix(nextjs): Handle pathname being passed in object in instrumentServer #5782

Conversation

lobsterkatie
Copy link
Member

@lobsterkatie lobsterkatie commented Sep 20, 2022

In nextjs version 12.2.6, the signature of findPageComponents which we wrap in instrumentServer changed, from accepting individual parameters to accepting an options object. This changes our wrapping to accommodate that, and as a result fixes transactions started by instrumentServer being parameterized as [ object Object ]. For backwards compatibility with older versions of next, individual parameters also continue to be accepted.

const wrappedMethod = async function (this: Server, parameterizedPath: string, ...args: any[]): Promise<any> {
const wrappedMethod = async function (
this: Server,
parameterizedPath: string | { pathname: string },
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 we should add a comment here explaining that the two different types come from two different nextjs versions.

@lobsterkatie lobsterkatie force-pushed the kmclb-nextjs-fix-path-parameterization-in-instrument-server branch from 4497932 to 9582902 Compare September 21, 2022 16:09
@lobsterkatie lobsterkatie merged commit fa8c15b into master Sep 22, 2022
@lobsterkatie lobsterkatie deleted the kmclb-nextjs-fix-path-parameterization-in-instrument-server branch September 22, 2022 03:45
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

Successfully merging this pull request may close these issues.

2 participants