Skip to content

Conversation

@andreiborza
Copy link
Member

No description provided.

github-actions bot and others added 19 commits December 16, 2025 16:04
[Gitflow] Merge master into develop
This PR updates the Sentry Next.js integration to improve tree-shaking
configuration and add new options for finer control over what SDK code
is included in the final bundle.

The most significant changes are:

- Added several new tree-shaking flags for better user DX.


Closes #18417

---------

Co-authored-by: Copilot <[email protected]>
…es/e2e-tests/test-applications/node-express-incorrect-instrumentation (#18530)

Bumps
[@trpc/server](https://github.com/trpc/trpc/tree/HEAD/packages/server)
from 10.45.2 to 10.45.3.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/trpc/trpc/commits/HEAD/packages/server">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@trpc/server&package-manager=npm_and_yarn&previous-version=10.45.2&new-version=10.45.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/getsentry/sentry-javascript/network/alerts).

</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Undo #18524 as the issue has been resolved and `1.25.1` has been
released
…#18501)

Previously, we only got the body from the `fetch` options. However, some
people use the `Request` object which can also contain a body. As this
body is a `ReadableStream`, we could only read that async.

With `attachRawBodyFromRequest`, the `Request` object is patched to
include the raw body as a `Symbol` so it can be read synchronously.

Linear ticket (internal):
https://linear.app/getsentry/issue/JS-1255/investigate-sdk-issues-causing-all-requests-to-default-to-get
…d` (#18536)

This comes strictly from OTel and we don't really need to assert on it,
it's unreliable and flaky.

Closes #18537 (added automatically)
This PR adds tracing for tss server functions. To achieve this I added a
new `wrapFetchWithSentry` wrapper that can be used to instrument the tss
server entry point:

```
import { wrapFetchWithSentry } from '@sentry/tanstackstart-react';

import handler, { createServerEntry } from '@tanstack/react-start/server-entry';

const requestHandler = wrapFetchWithSentry({
  fetch(request: Request) {
    return handler.fetch(request);
  },
});

export default createServerEntry(requestHandler);
```

With this we get spans for server functions executed via `fetch` calls
to the server. A limitation of this approach is that out-of-the-box this
will only start a single span for the initial request made to the
server. So for instance if a server function calls another server
function, we will still only get a single span for the outer server
function and users would need to wrap the inner call manually.

Tests added:
- E2E: Basic transaction test to verify that we get spans if a server
function is executed.
- E2E: Another transaction test documenting that users need to manually
wrap "nested" server functions.
- Unit: Tests to verify the sha256 extraction.

Closes #18287
With this PR we get this attributes from the initialization request and
response into the `initialize` span:

- `mcp.client.name`, `mcp.client.version`, `mcp.client.title` (from
request)
- `mcp.server.name`, `mcp.server.version`, `mcp.server.title` (from
response)
- `mcp.protocol.version` (from both request and response)

Changes:
- Extract client info and protocol version from the `initialize` request
and set them on the span after creation in `transport.ts`
- Extract server info and protocol version from the `initialize`
response in `completeSpanWithResults` and add them to the span
- Add two new helper functions `buildClientAttributesFromInfo` and
`buildServerAttributesFromInfo` to build attributes directly from
`PartyInfo` objects

Closes #18532 (added automatically)
…8544)

closes #18396

also removed some remaining debug logs in other tests, because why not
…8542)

Adjusted the condition for reporting web vitals previously it would
short circuit and prevent them from being reported, I included a test.

similar to what we did in #18463

closes #18540
The newly released [React Router
7.11.0](remix-run/react-router#14507) introduced
vite preview
support(remix-run/react-router#14507). This
change has a bug that affects SPA mode (`ssr: false`).

When building in SPA mode, React Router correctly builds the server
bundle (`build/server/index.js`) and then removes it with the message
`Removing the server build... due to ssr:false`.

The new vite preview implementation doesn't account for this removal and
attempts to import the deleted `build/server/index.js` file when
starting the preview server, causing:

 > Cannot find module '/build/server/index.js'


Closes #18549 (added automatically)
Add support for scope attributes on logs. For now, only
primitive attribute values are supported despite type declarations of
`Scope.setAttribute(s)` also allowing array attribute values. The reason
for this limited support is that Relay still discards array attribute
values. Therefore, our serialization strategy for now is:

- **As previously**: We continue to stringify non-primitive values for
log/metric attributes
- **New:** We apply only primitive scope attributes on logs/metrics and
discard any non-primitive values
- **Future:** We'll uniformly handle arrays (properly) in v11 (i.e. no
longer stringify them), i.e. treat all attributes equally.


### Usage Example

```ts
Sentry.getCurrenScope().setAttribute('user_is_admin', true);

Sentry.logger.info(`user ${user.id} logged in`, { activeSince: 100 });
Sentry.logger.warn('unsupported version');

// `user_is_admin` attribute is applied to both logs
```

Some behavior notes:
- Scope attributes are merged from all active scopes (current,
isolation, global scopes) when the log is captured
- Log attributes have precedence over scope attributes

closes #18159
Forgot to add a changelog entry in
#18184 and didn't
want to rerun CI again because I was fighting it since yesterday.

This PR also reformats the existing entries so that the paragraphs about
the important changes are indented correctly.

Closes #18557 (added automatically)
…es/e2e-tests/test-applications/node-express-v5 (#18550)

Bumps
[@trpc/server](https://github.com/trpc/trpc/tree/HEAD/packages/server)
from 10.45.2 to 10.45.3.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/trpc/trpc/commits/HEAD/packages/server">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@trpc/server&package-manager=npm_and_yarn&previous-version=10.45.2&new-version=10.45.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/getsentry/sentry-javascript/network/alerts).

</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…18558)

Forgot to add a changeling entry for the server function tracing PR.


Closes #18559 (added automatically)
@andreiborza andreiborza requested a review from a team as a code owner December 18, 2025 10:53
Comment on lines 21 to 31
context: ServerComponentContext,
): F {
const { componentRoute, componentType } = context;
// Even though users may define server components as async functions, for the client bundles
// Next.js will turn them into synchronous functions and it will transform any `await`s into instances of the `use`
// hook. 🤯
return new Proxy(appDirComponent, {
apply: (originalFunction, thisArg, args) => {
const requestTraceId = getActiveSpan()?.spanContext().traceId;
const isolationScope = commonObjectToIsolationScope(context.headers);

const activeSpan = getActiveSpan();
if (activeSpan) {
const rootSpan = getRootSpan(activeSpan);
const { scope } = getCapturedScopesOnSpan(rootSpan);
setCapturedScopesOnSpan(rootSpan, scope ?? new Scope(), isolationScope);
}
const isolationScope = getIsolationScope();

const headersDict = context.headers ? winterCGHeadersToDict(context.headers) : undefined;

Copy link

Choose a reason for hiding this comment

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

Bug: The removal of withIsolationScope in wrapServerComponentWithSentry prevents the transaction name and other scope data from being correctly propagated in the async context for server components.
Severity: HIGH | Confidence: High

🔍 Detailed Analysis

The refactored wrapServerComponentWithSentry function no longer uses the withIsolationScope context manager. This is critical for propagating scope changes, such as the transaction name set via isolationScope.setTransactionName(), to the async context. Without this wrapper, scope modifications are only applied to a local variable and are not reflected in child operations, breaking trace continuity and transaction naming for server components. Other similar functions like wrapGenerationFunctionWithSentry and wrapRouteHandlerWithSentry retain this wrapper, indicating its removal was likely an oversight. This change also removes explicit propagation context initialization from headers, further degrading tracing capabilities, especially in edge runtime environments.

💡 Suggested Fix

Reinstate the withIsolationScope wrapper around the component's execution logic in wrapServerComponentWithSentry. This will ensure that the isolation scope is correctly set in the async context, allowing transaction names and other context data to propagate correctly to child spans and operations. The implementation should be similar to the pattern used in wrapGenerationFunctionWithSentry.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: packages/nextjs/src/common/wrapServerComponentWithSentry.ts#L20-L31

Potential issue: The refactored `wrapServerComponentWithSentry` function no longer uses
the `withIsolationScope` context manager. This is critical for propagating scope
changes, such as the transaction name set via `isolationScope.setTransactionName()`, to
the async context. Without this wrapper, scope modifications are only applied to a local
variable and are not reflected in child operations, breaking trace continuity and
transaction naming for server components. Other similar functions like
`wrapGenerationFunctionWithSentry` and `wrapRouteHandlerWithSentry` retain this wrapper,
indicating its removal was likely an oversight. This change also removes explicit
propagation context initialization from headers, further degrading tracing capabilities,
especially in edge runtime environments.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 7697270

@github-actions
Copy link
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.82 kB added added
@sentry/browser - with treeshaking flags 23.32 kB added added
@sentry/browser (incl. Tracing) 41.59 kB added added
@sentry/browser (incl. Tracing, Profiling) 46.2 kB added added
@sentry/browser (incl. Tracing, Replay) 80.18 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 69.91 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 84.87 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 97.1 kB added added
@sentry/browser (incl. Feedback) 41.54 kB added added
@sentry/browser (incl. sendFeedback) 29.51 kB added added
@sentry/browser (incl. FeedbackAsync) 34.5 kB added added
@sentry/react 26.54 kB added added
@sentry/react (incl. Tracing) 43.79 kB added added
@sentry/vue 29.29 kB added added
@sentry/vue (incl. Tracing) 43.41 kB added added
@sentry/svelte 24.84 kB added added
CDN Bundle 27.25 kB added added
CDN Bundle (incl. Tracing) 42.24 kB added added
CDN Bundle (incl. Tracing, Replay) 78.95 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 84.42 kB added added
CDN Bundle - uncompressed 80.06 kB added added
CDN Bundle (incl. Tracing) - uncompressed 125.41 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 241.94 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 254.71 kB added added
@sentry/nextjs (client) 46.01 kB added added
@sentry/sveltekit (client) 41.97 kB added added
@sentry/node-core 51.61 kB added added
@sentry/node 161.5 kB added added
@sentry/node - without tracing 93.05 kB added added
@sentry/aws-serverless 108.56 kB added added

@github-actions
Copy link
Contributor

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 9,430 - - added
GET With Sentry 1,801 19% - added
GET With Sentry (error only) 6,137 65% - added
POST Baseline 1,190 - - added
POST With Sentry 604 51% - added
POST With Sentry (error only) 1,054 89% - added
MYSQL Baseline 3,294 - - added
MYSQL With Sentry 445 14% - added
MYSQL With Sentry (error only) 2,689 82% - added

@andreiborza andreiborza merged commit 445b682 into master Dec 18, 2025
397 of 402 checks passed
@andreiborza andreiborza deleted the prepare-release/10.32.0 branch December 18, 2025 11:19
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.

9 participants