Skip to content

Commit dce44ab

Browse files
authored
Merge pull request #10964 from getsentry/abhi-7.106.0-release
chore: Backport Release for `7.106.0`
2 parents 369fc52 + 0161a8b commit dce44ab

File tree

15 files changed

+72
-26
lines changed

15 files changed

+72
-26
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@
44

55
- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott
66

7+
## 7.106.0
8+
9+
- feat(nextjs): Support Hybrid Cloud DSNs with `tunnelRoute` option (#10958)
10+
- feat(remix): Add Vite dev-mode support to Express instrumentation (#10811)
11+
- fix(core): Undeprecate `setTransactionName`
12+
- fix(browser): Don't use chrome variable name (#10874)
13+
- fix(nextjs): Client code should not use Node `global` (#10925)
14+
- fix(node): support undici headers as strings or arrays (#10938)
15+
- fix(types): Add `AttachmentType` and use for envelope `attachment_type` property (#10946)
16+
- ref(ember): Avoid namespace import to hopefully resolve minification issue (#10885)
17+
- chore(sveltekit): Fix punctuation in a console.log (#10895)
18+
19+
Work in this release contributed by @jessezhang91 and @bfontaine. Thank you for your contributions!
20+
721
## 7.105.0
822

923
### Important Changes

packages/browser/src/stack-parsers.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ const chromeRegex =
5858
/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
5959
const chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/;
6060

61-
const chrome: StackLineParserFn = line => {
61+
// We cannot call this variable `chrome` because it can conflict with global `chrome` variable in certain environments
62+
// See: https://github.com/getsentry/sentry-javascript/issues/6880
63+
const chromeStackParserFn: StackLineParserFn = line => {
6264
const parts = chromeRegex.exec(line);
6365

6466
if (parts) {
@@ -85,7 +87,7 @@ const chrome: StackLineParserFn = line => {
8587
return;
8688
};
8789

88-
export const chromeStackLineParser: StackLineParser = [CHROME_PRIORITY, chrome];
90+
export const chromeStackLineParser: StackLineParser = [CHROME_PRIORITY, chromeStackParserFn];
8991

9092
// gecko regex: `(?:bundle|\d+\.js)`: `bundle` is for react native, `\d+\.js` also but specifically for ram bundles because it
9193
// generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js

packages/core/src/scope.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ export class Scope implements ScopeInterface {
294294

295295
/**
296296
* Sets the transaction name on the scope for future events.
297-
* @deprecated Use extra or tags instead.
298297
*/
299298
public setTransactionName(name?: string): this {
300299
this._transactionName = name;

packages/core/test/lib/transports/base.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const ATTACHMENT_ENVELOPE = createEnvelope<EventEnvelope>(
2323
length: 20,
2424
filename: 'test-file.txt',
2525
content_type: 'text/plain',
26-
attachment_type: 'text',
26+
attachment_type: 'event.attachment',
2727
},
2828
'attachment content',
2929
] as AttachmentItem,

packages/ember/addon/instance-initializers/sentry-performance.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,20 @@ import type RouterService from '@ember/routing/router-service';
66
import { _backburner, run, scheduleOnce } from '@ember/runloop';
77
import type { EmberRunQueues } from '@ember/runloop/-private/types';
88
import { getOwnConfig, isTesting, macroCondition } from '@embroider/macros';
9-
import * as Sentry from '@sentry/browser';
109
import type { ExtendedBackburner } from '@sentry/ember/runloop';
1110
import type { Span } from '@sentry/types';
1211
import { GLOBAL_OBJ, browserPerformanceTimeOrigin, timestampInSeconds } from '@sentry/utils';
1312

14-
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core';
15-
import type { BrowserClient } from '..';
16-
import { getActiveSpan, startInactiveSpan } from '..';
13+
import type { BrowserClient } from '@sentry/browser';
14+
import {
15+
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
16+
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
17+
getActiveSpan,
18+
getClient,
19+
startBrowserTracingNavigationSpan,
20+
startBrowserTracingPageLoadSpan,
21+
startInactiveSpan,
22+
} from '@sentry/browser';
1723
import type { EmberRouterMain, EmberSentryConfig, GlobalConfig, OwnConfig } from '../types';
1824

1925
function getSentryConfig(): EmberSentryConfig {
@@ -103,7 +109,7 @@ export function _instrumentEmberRouter(
103109
const browserTracingOptions = config.browserTracingOptions || config.sentry.browserTracingOptions || {};
104110
const url = getLocationURL(location);
105111

106-
const client = Sentry.getClient<BrowserClient>();
112+
const client = getClient<BrowserClient>();
107113

108114
if (!client) {
109115
return;
@@ -115,7 +121,7 @@ export function _instrumentEmberRouter(
115121
browserTracingOptions.instrumentPageLoad !== false
116122
) {
117123
const routeInfo = routerService.recognize(url);
118-
activeRootSpan = Sentry.startBrowserTracingPageLoadSpan(client, {
124+
activeRootSpan = startBrowserTracingPageLoadSpan(client, {
119125
name: `route:${routeInfo.name}`,
120126
origin: 'auto.pageload.ember',
121127
attributes: {
@@ -148,7 +154,7 @@ export function _instrumentEmberRouter(
148154
const { fromRoute, toRoute } = getTransitionInformation(transition, routerService);
149155
activeRootSpan?.end();
150156

151-
activeRootSpan = Sentry.startBrowserTracingNavigationSpan(client, {
157+
activeRootSpan = startBrowserTracingNavigationSpan(client, {
152158
name: `route:${toRoute}`,
153159
origin: 'auto.navigation.ember',
154160
attributes: {
@@ -429,7 +435,7 @@ export async function instrumentForPerformance(appInstance: ApplicationInstance)
429435
instrumentPageLoad: false,
430436
});
431437

432-
const client = Sentry.getClient<BrowserClient>();
438+
const client = getClient<BrowserClient>();
433439

434440
const isAlreadyInitialized = macroCondition(isTesting()) ? !!client?.getIntegrationByName('BrowserTracing') : false;
435441

packages/nextjs/src/client/rewriteFramesIntegration.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { defineIntegration } from '@sentry/core';
22
import { rewriteFramesIntegration as originalRewriteFramesIntegration } from '@sentry/integrations';
33
import type { IntegrationFn, StackFrame } from '@sentry/types';
4+
import { GLOBAL_OBJ } from '@sentry/utils';
45

5-
const globalWithInjectedValues = global as typeof global & {
6+
const globalWithInjectedValues = GLOBAL_OBJ as typeof GLOBAL_OBJ & {
67
__rewriteFramesAssetPrefixPath__: string;
78
};
89

packages/nextjs/src/client/tunnelRoute.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { BrowserOptions } from '@sentry/react';
2-
import { dsnFromString, logger } from '@sentry/utils';
2+
import { GLOBAL_OBJ, dsnFromString, logger } from '@sentry/utils';
33

44
import { DEBUG_BUILD } from '../common/debug-build';
55

6-
const globalWithInjectedValues = global as typeof global & {
6+
const globalWithInjectedValues = GLOBAL_OBJ as typeof GLOBAL_OBJ & {
77
__sentryRewritesTunnelPath__?: string;
88
};
99

packages/nextjs/src/server/rewriteFramesIntegration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import {
55
rewriteFramesIntegration as originalRewriteFramesIntegration,
66
} from '@sentry/integrations';
77
import type { IntegrationFn, StackFrame } from '@sentry/types';
8-
import { escapeStringForRegex } from '@sentry/utils';
8+
import { GLOBAL_OBJ, escapeStringForRegex } from '@sentry/utils';
99

10-
const globalWithInjectedValues = global as typeof global & {
10+
const globalWithInjectedValues = GLOBAL_OBJ as typeof GLOBAL_OBJ & {
1111
__rewriteFramesDistDir__?: string;
1212
};
1313

packages/node/src/integrations/undici/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,13 @@ function setHeadersOnRequest(
309309
sentryTrace: string,
310310
sentryBaggageHeader: string | undefined,
311311
): void {
312-
const headerLines = request.headers.split('\r\n');
313-
const hasSentryHeaders = headerLines.some(headerLine => headerLine.startsWith('sentry-trace:'));
312+
let hasSentryHeaders: boolean;
313+
if (Array.isArray(request.headers)) {
314+
hasSentryHeaders = request.headers.some(headerLine => headerLine === 'sentry-trace');
315+
} else {
316+
const headerLines = request.headers.split('\r\n');
317+
hasSentryHeaders = headerLines.some(headerLine => headerLine.startsWith('sentry-trace:'));
318+
}
314319

315320
if (hasSentryHeaders) {
316321
return;

packages/node/src/integrations/undici/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,9 @@ export interface UndiciRequest {
224224
// Originally was Dispatcher.HttpMethod, but did not want to vendor that in.
225225
method?: string;
226226
path: string;
227-
headers: string;
227+
// string for undici@<=6.6.2 and string[] for undici@>=6.7.0.
228+
// see for more information: https://github.com/getsentry/sentry-javascript/issues/10936
229+
headers: string | string[];
228230
addHeader(key: string, value: string): RequestWithSentry;
229231
}
230232

packages/sveltekit/src/vite/sourceMaps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export async function makeCustomSentryVitePlugin(options?: CustomSentryVitePlugi
212212
console.warn('[Source Maps Plugin] Failed to upload source maps!');
213213
// eslint-disable-next-line no-console
214214
console.log(
215-
'[Source Maps Plugin] Please make sure, you specified a valid Sentry auth token, as well as your org and project slugs.',
215+
'[Source Maps Plugin] Please make sure you specified a valid Sentry auth token, as well as your org and project slugs.',
216216
);
217217
// eslint-disable-next-line no-console
218218
console.log(

packages/types/src/attachment.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
1+
export type AttachmentType =
2+
| 'event.attachment'
3+
| 'event.minidump'
4+
| 'event.applecrashreport'
5+
| 'unreal.context'
6+
| 'unreal.logs';
7+
8+
/**
9+
* An attachment to an event. This is used to upload arbitrary data to Sentry.
10+
*
11+
* Please take care to not add sensitive information in attachments.
12+
*
13+
* https://develop.sentry.dev/sdk/envelopes/#attachment
14+
*/
115
export interface Attachment {
216
data: string | Uint8Array;
317
filename: string;
418
contentType?: string;
5-
attachmentType?: string;
19+
/**
20+
* The type of the attachment. Defaults to `event.attachment` if not specified.
21+
*/
22+
attachmentType?: AttachmentType;
623
}

packages/types/src/envelope.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { AttachmentType } from './attachment';
12
import type { SerializedCheckIn } from './checkin';
23
import type { ClientReport } from './clientreport';
34
import type { DsnComponents } from './dsn';
@@ -72,7 +73,7 @@ type AttachmentItemHeaders = {
7273
length: number;
7374
filename: string;
7475
content_type?: string;
75-
attachment_type?: string;
76+
attachment_type?: AttachmentType;
7677
};
7778
type UserFeedbackItemHeaders = { type: 'user_report' };
7879
type FeedbackItemHeaders = { type: 'feedback' };

packages/types/src/scope.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ export interface Scope {
126126

127127
/**
128128
* Sets the transaction name on the scope for future events.
129-
* @deprecated Use extra or tags instead.
130129
*/
131130
setTransactionName(name?: string): this;
132131

packages/utils/src/vendor/supportsHistory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export function supportsHistory(): boolean {
3838
// borrowed from: https://github.com/angular/angular.js/pull/13945/files
3939
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
4040
// eslint-disable-next-line @typescript-eslint/no-explicit-any
41-
const chrome = (WINDOW as any).chrome;
42-
const isChromePackagedApp = chrome && chrome.app && chrome.app.runtime;
41+
const chromeVar = (WINDOW as any).chrome;
42+
const isChromePackagedApp = chromeVar && chromeVar.app && chromeVar.app.runtime;
4343
/* eslint-enable @typescript-eslint/no-unsafe-member-access */
4444
const hasHistoryApi = 'history' in WINDOW && !!WINDOW.history.pushState && !!WINDOW.history.replaceState;
4545

0 commit comments

Comments
 (0)