Skip to content

Wrong request headers when instrument the fetch with 2 parameters and they both have headers #10172

@Kaciras

Description

@Kaciras

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/vue

SDK Version

7.93.0

Framework Version

Vue 3.4.10

Link to Sentry event

No response

SDK Setup

Sentry.init({
	// dsn: "",
	tracesSampleRate: 1.0,
	integrations: [
		new Sentry.BrowserTracing(),
	],
});

Steps to Reproduce

const request = new Request("/test", {
	headers: { foo: "11" },
});
fetch(request, {
	headers: { bar: "22" },
});

Expected Result

The request should have the header bar: 22.

Actual Result

request

I believe it was a mistake in selecting the request headers to be merged.

const headers =
typeof Request !== 'undefined' && isInstanceOf(request, Request) ? (request as Request).headers : options.headers;

Metadata

Metadata

Assignees

Labels

BugPackage: browserIssues related to the Sentry Browser SDK

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions