Repository navigation
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- 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/react
SDK Version
11.12.0
Framework Version
React 19, TypeScript 6.0.3
Link to Sentry event
No response
Reproduction Example/SDK Setup
repro.ts:
import {
BrowserClient,
defaultStackParser,
makeFetchTransport,
type BrowserOptions,
} from '@sentry/react';
const options: BrowserOptions = {
dsn: 'https://00000000000000000000000000000000@example.invalid/0',
tunnel: '/tunnel',
};
export const client = new BrowserClient({
...options,
integrations: [],
stackParser: defaultStackParser,
transport: makeFetchTransport,
});tsconfig.json:
{
"compilerOptions": {
"noEmit": true,
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": false,
"lib": ["dom", "esnext"],
"skipLibCheck": true
},
"include": ["repro.ts"]
}package.json:
{ "name": "repro", "private": true, "type": "module" }Steps to Reproduce
npm install typescript@6.0.3 react@19 @sentry/react@11.9.0
npx tsc -p . # exit 0
npm install @sentry/react@11.10.0
npx tsc -p . # TS2345
npm install @sentry/react@11.11.0
npx tsc -p . # TS2345
npm install @sentry/react@11.12.0
npx tsc -p . # TS2345It fails with strict off and with --strict (only the printed type of integrations differs, undefined[] against never[]). skipLibCheck does not hide it, because the error is in user code.
Expected Result
It compiles, as on 11.9.0. Any one of these would do:
BrowserClientOptions.tunnelaccepts whatBrowserOptions.tunnelaccepts, or- the SDK exports the function that resolves a
TunnelInitto the URL string, so a caller constructing aBrowserClientcan resolve it first, or - the change is documented as breaking for callers who build a client from
BrowserOptions.
Actual Result
On 11.10.0, 11.11.0 and 11.12.0 (strict: false):
repro.ts(13,41): error TS2345: Argument of type '{ integrations: undefined[]; stackParser: StackParser; transport: (options: BrowserTransportOptions, nativeFetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) => Transport; ... 49 more ...; routeProvider?: RouteProvider; }' is not assignable to parameter of type 'BrowserClientOptions'.
Type '{ integrations: undefined[]; stackParser: StackParser; transport: (options: BrowserTransportOptions, nativeFetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) => Transport; ... 49 more ...; routeProvider?: RouteProvider; }' is not assignable to type 'ClientOptions<BrowserTransportOptions>'.
Types of property 'tunnel' are incompatible.
Type 'TunnelInit<TunnelOptions> & TunnelInit<BrowserTunnelOptions>' is not assignable to type 'string'.
Type 'boolean' is not assignable to type 'string'.
Additional Context
Description
Since 11.10.0, BrowserOptions.tunnel is typed TunnelInit<BrowserTunnelOptions> (string | true | BrowserTunnelOptions), while the options that new BrowserClient(...) takes (BrowserClientOptions = ClientOptions<BrowserTransportOptions> & BrowserSpecificOptions) still type tunnel as string.
An object typed as BrowserOptions can therefore no longer be spread into the BrowserClient constructor. This compiled through 11.9.0. It is a type-level regression in a minor release: code that builds a client by hand from BrowserOptions (for example to create a second, isolated client, or to test resolved options) stops compiling.
@sentry/react |
npx tsc -p . |
|---|---|
| 11.9.0 | exit 0 |
| 11.10.0 | TS2345 |
| 11.11.0 | TS2345 |
| 11.12.0 (latest) | TS2345 |
Environment: TypeScript 6.0.3, Node 24.22.2, react 19.
Where the two types diverge (11.11.0)
@sentry/core/build/types/types/options.d.ts:ClientOptions.tunnel?: string;andexport type TunnelInit<T extends TunnelOptions = TunnelOptions> = string | true | T;, withCoreOptionsnow omitting'tunnel'fromPartial<ClientOptions<TO>>and redeclaring it astunnel?: TunnelInit;@sentry/browser/build/npm/types/client.d.ts:tunnel?: TunnelInit<BrowserTunnelOptions>;on the browser options, andexport type BrowserClientOptions = ClientOptions<BrowserTransportOptions> & BrowserSpecificOptions;
Possibly related to the tunnel rework tracked in #25466 and #26193.
Priority
No response
Metadata
Metadata
Assignees
Projects
- StatusShow more project fieldsNo status
Activity
linear-code commentedon Nov 11, 2026
JS-4099
bunnysayzz commentedon Nov 11, 2026
Traced this to packages/browser/src/client.ts. BrowserOptions overrides tunnel to TunnelInit (line 99), but BrowserClientOptions (line 113) does not, so it inherits core tunnel?: string and the spread fails type-checking. The 11.10.0 managed tunnel feature widened only one side. There is a runtime gap too: init() resolves the tunnel via resolveBrowserTunnelOption, but new BrowserClient(options) never does, so true or an object would flow through unresolved. Fix would be widening the type on BrowserClientOptions and resolving it in the constructor. Happy to open a PR against develop if you give the go-ahead.
chore(deps): the @sentry/react hold cites the upstream issue and cove…
logaretm commentedon Nov 12, 2026
Hey folks, thanks for taking interest in this issue. The Tunnel improvements is an ongoing project and we would prefer to own the related work to it ourselves in the meanwhile.
We appreciate your eagerness to take this on, but we will handle this one for now and get a fix out within the day.
fix(browser): Accept managed tunnel options in the `BrowserClient` co…
github-actions commentedon Nov 16, 2026
A PR closing this issue has just been released 🚀
This issue was referenced by PR #26313, which was included in the 11.13.0 release.