Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/browser/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ export class BrowserClient extends BaseClient<BrowserClientOptions> {
const envelope = createUserFeedbackEnvelope(feedback, {
metadata: this.getSdkMetadata(),
dsn: this.getDsn(),
tunnel: this.getOptions().tunnel,
});

// sendEnvelope should not throw
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/userfeedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function createUserFeedbackEnvelope(
dsn,
}: {
metadata: SdkMetadata | undefined;
tunnel: string | undefined;
tunnel?: string | undefined;
dsn: DsnComponents | undefined;
},
): EventEnvelope {
Expand Down
9 changes: 4 additions & 5 deletions packages/core/src/baseclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,10 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
if (this._dsn) {
const url = getEnvelopeEndpointWithUrlEncodedAuth(
this._dsn,
options.tunnel,
undefined,
options._metadata ? options._metadata.sdk : undefined,
);
this._transport = options.transport({
tunnel: this._options.tunnel,
recordDroppedEvent: this.recordDroppedEvent.bind(this),
...options.transportOptions,
url,
Expand Down Expand Up @@ -353,7 +352,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
public sendEvent(event: Event, hint: EventHint = {}): void {
this.emit('beforeSendEvent', event, hint);

let env = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel);
let env = createEventEnvelope(event, this._dsn, this._options._metadata);

for (const attachment of hint.attachments || []) {
env = addItemToEnvelope(env, createAttachmentEnvelopeItem(attachment));
Expand All @@ -369,7 +368,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
* @inheritDoc
*/
public sendSession(session: Session | SessionAggregates): void {
const env = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel);
const env = createSessionEnvelope(session, this._dsn, this._options._metadata);

// sendEnvelope should not throw
// eslint-disable-next-line @typescript-eslint/no-floating-promises
Expand Down Expand Up @@ -915,7 +914,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {

DEBUG_BUILD && logger.log('Sending outcomes:', outcomes);

const envelope = createClientReportEnvelope(outcomes, this._options.tunnel && dsnToString(this._dsn));
const envelope = createClientReportEnvelope(outcomes);

// sendEnvelope should not throw
// eslint-disable-next-line @typescript-eslint/no-floating-promises
Expand Down
4 changes: 0 additions & 4 deletions packages/core/src/envelope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,9 @@ export function createSpanEnvelope(spans: [SentrySpan, ...SentrySpan[]], client?
// different segments in one envelope
const dsc = getDynamicSamplingContextFromSpan(spans[0]);

const dsn = client && client.getDsn();
const tunnel = client && client.getOptions().tunnel;

const headers: SpanEnvelope[0] = {
sent_at: new Date().toISOString(),
...(dscHasRequiredProps(dsc) && { trace: dsc }),
...(!!tunnel && dsn && { dsn: dsnToString(dsn) }),
};

const beforeSendSpan = client && client.getOptions().beforeSendSpan;
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/metrics/envelope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ export function captureAggregateMetrics(client: Client, metricBucketItems: Array
logger.log(`Flushing aggregated metrics, number of metrics: ${metricBucketItems.length}`);
const dsn = client.getDsn();
const metadata = client.getSdkMetadata();
const tunnel = client.getOptions().tunnel;

const metricsEnvelope = createMetricEnvelope(metricBucketItems, dsn, metadata, tunnel);
const metricsEnvelope = createMetricEnvelope(metricBucketItems, dsn, metadata);

// sendEnvelope should not throw
// eslint-disable-next-line @typescript-eslint/no-floating-promises
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/transports/multiplexed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export function makeMultiplexedTransport<TO extends BaseTransportOptions>(
if (!validatedDsn) {
return undefined;
}
const url = getEnvelopeEndpointWithUrlEncodedAuth(validatedDsn, options.tunnel);
const url = getEnvelopeEndpointWithUrlEncodedAuth(validatedDsn);

transport = release
? makeOverrideReleaseTransport(createTransport, release)({ ...options, url })
Expand Down
15 changes: 1 addition & 14 deletions packages/core/src/utils/isSentryRequestUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,9 @@ import type { Client, DsnComponents } from '@sentry/types';
*/
export function isSentryRequestUrl(url: string, client: Client | undefined): boolean {
const dsn = client && client.getDsn();
const tunnel = client && client.getOptions().tunnel;
return checkDsn(url, dsn) || checkTunnel(url, tunnel);
}

function checkTunnel(url: string, tunnel: string | undefined): boolean {
if (!tunnel) {
return false;
}

return removeTrailingSlash(url) === removeTrailingSlash(tunnel);
return checkDsn(url, dsn);
}

function checkDsn(url: string, dsn: DsnComponents | undefined): boolean {
return dsn ? url.includes(dsn.host) : false;
}

function removeTrailingSlash(str: string): string {
return str[str.length - 1] === '/' ? str.slice(0, -1) : str;
}
Loading