getsentry / getsentry/sentry-javascript

Next.js Pages Router `getServerSideProps` is wrapped in `@sentry/nextjs` v10, but no `function.nextjs` spans are emitted, so Slow SSR widget stays empty

Đang mở
#21,480 2 bình luận 0 reaction 1 người được giao Được @isaacs nhận Xem trên GitHub
Bug Next.js
Ngôn ngữ chính
TypeScript
Star
8.7k
Fork
1.8k
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
515

Mô tả

### Is there an existing issue for this?

- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- [x] I have reviewed the documentation https://docs.sentry.io/
- [x] 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/nextjs

### SDK Version

10.55.0

### Framework Version

15.5.18

### Link to Sentry event

_No response_

### Reproduction Example/SDK Setup

We are using a Next.js Pages Router app with SSR via `getServerSideProps` on many routes.

Versions:
- `next`: `15.5.18`
- `@sentry/nextjs`: `10.55.0`

Sentry setup:
- `withSentryConfig(...)` is enabled in `next.config.js`
- `webpack.autoInstrumentServerFunctions: true` is explicitly enabled
- `instrumentation.ts` exists and imports `sentry.server.config` / `sentry.edge.config`
- `Sentry.init(...)` is active on the server with `tracesSampleRate > 0`
- Server-side data is definitely reaching Sentry already (`http.server`, middleware, and related spans are visible)

Important verification from our side:
- We inspected the compiled production output and confirmed that page handlers are wrapped with `wrapGetServerSidePropsWithSentry(...)`
- So the build-time wrapping appears to be active
- However, we still see no `function.nextjs` spans in Sentry

### Steps to Reproduce

1. Create or use a Next.js 15 Pages Router app.
2. Install `@sentry/nextjs@10.x`.
3. Configure Sentry with:
- `withSentryConfig(...)`
- `instrumentation.ts`
- server tracing enabled
- `webpack.autoInstrumentServerFunctions: true`
4. Add one or more Pages Router routes using `getServerSideProps`.
5. Build/run the app and hit SSR pages.
6. Inspect incoming spans/traces in Sentry and check the Slow SSR widget.

### Expected Result

One of the following should happen consistently:

- `getServerSideProps` instrumentation emits SSR spans recognizable by the Slow SSR widget, including `function.nextjs` if that is still the expected span op

or

- the documentation/widget behavior should clearly reflect the new span model if `function.nextjs` is no longer expected in `@sentry/nextjs` v10

In short: a correctly instrumented Pages Router SSR app should populate the Slow SSR widget or have documented replacement behavior.

### Actual Result

- Traces and server-side spans are sent successfully
- `http.server` and other server spans are visible
- `function.nextjs` spans never appear
- The Slow SSR widget remains empty

Additionally, after inspecting the installed SDK behavior, it appears that `wrapGetServerSidePropsWithSentry(...)` delegates to `withTracedServerSideDataFetcher(...)`, and that helper seems to set metadata / transaction naming / trace propagation, but does not appear to create a dedicated SSR child span with `op: "function.nextjs"`

That matches what we see in Sentry:
- wrapping exists
- tracing exists
- but the widget-relevant SSR spans do not exist

### Additional Context

This may be one of two things:

1. A bug/regression in `@sentry/nextjs` Pages Router SSR instrumentation for v10 / Next.js 15

or

2. A mismatch between current SDK span behavior and the Slow SSR widget, which may still depend on an older span shape/op such as `function.nextjs`

If `function.nextjs` is no longer intended in this SDK/version, could you clarify:
- what span(s) should replace it
- whether the Slow SSR widget supports that new model
- whether the docs should be updated for Pages Router SSR on modern Next.js / Sentry versions

### Priority

_No response_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.