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

未关闭
#21,480 2 条评论 0 个 reaction 已指派 1 人 已被 @isaacs 认领 在 GitHub 查看
Bug Next.js
主要语言
TypeScript
星标
8.7k
派生
1.8k
平均合并
1 天 17 小时
30 天内合并 PR
523

描述

### 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_

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。