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

Next.js: Give App Router Prefetch serverside transactions different op #13596

Open
lforst opened this issue Sep 5, 2024 · 2 comments
Open

Next.js: Give App Router Prefetch serverside transactions different op #13596

lforst opened this issue Sep 5, 2024 · 2 comments
Assignees
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK

Comments

@lforst
Copy link
Member

lforst commented Sep 5, 2024

Description

It would be good to give these transactions a different op so that it is easier to identify what these transactions are about.

@lforst lforst self-assigned this Sep 5, 2024
@AbhiPrasad AbhiPrasad added the Package: nextjs Issues related to the Sentry Nextjs SDK label Sep 9, 2024
@lforst
Copy link
Member Author

lforst commented Sep 10, 2024

I need to note a few things/problems for posterity.

All versions:

  • Next.js doesn't seem to forward the Next-Router-Prefetch: 1 header to the headers object we can access inside server components.
  • Sometimes a prefetch header is sent, sometimes a Next-Router-State-Tree: asdfasdf header is sent. Seems like the prefetch header is sent when the current page is a dynamic page.

next@13:

  • We can access the actual headers including the Next-Router-Prefetch: 1 header through the http integration because requests are properly instrumented.

next@14:

  • The HTTP instrumentation doesn't work for Next.js 14 so there is no way to access the prefetch header.

next@15:

  • The Next.js 15 RC doesn't seem to send a prefetch header

13, 14:

  • Prefetch requests will be detached because these versions don't support clientTraceMetadata.

Low-key wtf @ the integration not working for Next.js 14.

lforst added a commit that referenced this issue Sep 10, 2024
…ch` op (#13600)

Ref (not complete fix)
#13596

This gives Next.js prefetch requests a `http.server.prefetch` op, when a
`Next-Router-Prefetch: 1` header is present.

In some situations Next.js doesn't seem to attach the header for
prefetch requests. Seems like it is only attached when the current route
is a dynamic route.
@lforst
Copy link
Member Author

lforst commented Sep 13, 2024

Note: We shipped a very simple implementation for this which doesn't cover all the cases. Due to resource constraints and also the framework not exposing the necessary date at this point in time I'll move this back into the backlog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK
Projects
None yet
Development

No branches or pull requests

2 participants