Skip to content

Commit 0c5e17a

Browse files
committed
Merge branch 'master' into jferg/add-replay_id-to-dsc
2 parents ee53c22 + d044224 commit 0c5e17a

File tree

338 files changed

+12696
-5418
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

338 files changed

+12696
-5418
lines changed

.craft.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ targets:
2222
- name: github
2323
includeNames: /^sentry-.*$/
2424
- name: npm
25+
excludeNames: /^sentry-sveltekit-.*$/
2526
- name: registry
2627
sdks:
2728
'npm:@sentry/browser':

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,10 @@
2323
"yaml.schemas": {
2424
"https://json.schemastore.org/github-workflow.json": ".github/workflows/**.yml"
2525
},
26+
"eslint.packageManager": "yarn",
27+
"eslint.workingDirectories": [
28+
{
29+
"mode": "auto"
30+
}
31+
]
2632
}

CHANGELOG.md

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

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

7+
## 7.43.0
8+
9+
- feat(nextjs): Run source map upload in Vercel develop and preview environments (#7436)
10+
- feat(types): Add `profilesSampler` option to node client type (#7385)
11+
- fix(core): Avoid using `Array.findIndex()` as it is ES5 incompatible (#7400)
12+
- fix(nextjs): Add better error messages for missing params during next build (#7434)
13+
- fix(nextjs): Don't crash build when auth token is missing
14+
- fix(node): Revert to dynamic `require` call to fix monkey patching (#7430)
15+
- fix(types): Fix node types & add E2E test (#7429)
16+
17+
18+
## 7.42.0
19+
20+
- feat(core): Add lifecycle hooks (#7370)
21+
- feat(core): Emit hooks for transaction start/finish (#7387)
22+
- feat(nextjs): Connect traces for server components (#7320)
23+
- feat(replay): Attach an error `cause` to send exceptions (#7350)
24+
- feat(replay): Consider user input in form field as "user activity" (#7355)
25+
- feat(replay): Update rrweb to 1.105.0 & add breadcrumb when encountering large mutation (#7314)
26+
- feat(tracing): Expose cancelIdleTimeout and add option to make it permanent (#7236)
27+
- feat(tracing): Track PerformanceObserver interactions as spans (#7331)
28+
- fix(core): Ensure `originalException` has type `unknown` (#7361)
29+
- fix(core): Avoid using `Object.values()` (#7360)
30+
- fix(react): Make redux integration be configurable via `normalizeDepth` (#7379)
31+
- fix(tracing): Record LCP and CLS on transaction finish (#7386)
32+
- ref(browser): Improve type safety of breadcrumbs integration (#7382)
33+
- ref(node): Parallelize disk io when reading source files for context lines (#7374)
34+
- ref(node): Partially remove dynamic `require` calls (#7377)
35+
36+
**Replay `rrweb` changes:**
37+
38+
`@sentry-internal/rrweb` was updated from 1.104.1 to 1.105.0 (#7314):
39+
40+
- feat: Add `onMutation` option to record ([#70](https://github.com/getsentry/rrweb/pull/69))
41+
- fix: Ensure `<input type='submit' value='Btn text'>` is masked ([#69](https://github.com/getsentry/rrweb/pull/69))
42+
743
## 7.41.0
844

945
- feat: Ensure we use the same default `environment` everywhere (#7327)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ package. Please refer to the README and instructions of those SDKs for more deta
5252
integrations for Express
5353
- [`@sentry/angular`](https://github.com/getsentry/sentry-javascript/tree/master/packages/angular): Browser SDK with
5454
Angular integration enabled
55+
- [`@sentry/angular-ivy`](https://github.com/getsentry/sentry-javascript/tree/master/packages/angular-ivy): Browser SDK with
56+
Angular integration enabled including native support for Angular's Ivy rendering engine.
5557
- [`@sentry/ember`](https://github.com/getsentry/sentry-javascript/tree/master/packages/ember): Browser SDK with Ember
5658
integration enabled
5759
- [`@sentry/react`](https://github.com/getsentry/sentry-javascript/tree/master/packages/react): Browser SDK with React

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
3-
"version": "7.41.0",
3+
"version": "7.43.0",
44
"npmClient": "yarn",
55
"useWorkspaces": true
66
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"packages/replay-worker",
5959
"packages/serverless",
6060
"packages/svelte",
61+
"packages/sveltekit",
6162
"packages/tracing",
6263
"packages/types",
6364
"packages/typescript",

packages/angular-ivy/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66

77
# Official Sentry SDK for Angular with Ivy Compatibility
88

9+
[![npm version](https://img.shields.io/npm/v/@sentry/angular-ivy.svg)](https://www.npmjs.com/package/@sentry/angular-ivy)
10+
[![npm dm](https://img.shields.io/npm/dm/@sentry/angular-ivy.svg)](https://www.npmjs.com/package/@sentry/angular-ivy)
11+
[![npm dt](https://img.shields.io/npm/dt/@sentry/angular-ivy.svg)](https://www.npmjs.com/package/@sentry/angular-ivy)
12+
913
## Links
1014

1115
- [Official SDK Docs](https://docs.sentry.io/platforms/javascript/angular/)
1216

1317
## Angular Version Compatibility
1418

15-
**Note**: This SDK is still experimental and not yet stable.
16-
We do not yet make guarantees in terms of breaking changes, version compatibilities or semver.
17-
Please open a Github issue if you experience bugs or would like to share feedback.
18-
1919
This SDK officially supports Angular 12-15 with Angular's new rendering engine, Ivy.
2020

2121
If you're using Angular 10, 11 or a newer Angular version with View Engine instead of Ivy, please use [`@sentry/angular`](https://github.com/getsentry/sentry-javascript/blob/develop/packages/angular/README.md).

packages/angular-ivy/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sentry/angular-ivy",
3-
"version": "7.41.0",
3+
"version": "7.43.0",
44
"description": "Official Sentry SDK for Angular with full Ivy Support",
55
"repository": "git://github.com/getsentry/sentry-javascript.git",
66
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/angular-ivy",
@@ -21,9 +21,9 @@
2121
"rxjs": "^6.5.5 || ^7.x"
2222
},
2323
"dependencies": {
24-
"@sentry/browser": "7.41.0",
25-
"@sentry/types": "7.41.0",
26-
"@sentry/utils": "7.41.0",
24+
"@sentry/browser": "7.43.0",
25+
"@sentry/types": "7.43.0",
26+
"@sentry/utils": "7.43.0",
2727
"tslib": "^2.3.0"
2828
},
2929
"devDependencies": {

packages/angular/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
# Official Sentry SDK for Angular
88

9+
[![npm version](https://img.shields.io/npm/v/@sentry/angular.svg)](https://www.npmjs.com/package/@sentry/angular)
10+
[![npm dm](https://img.shields.io/npm/dm/@sentry/angular.svg)](https://www.npmjs.com/package/@sentry/angular)
11+
[![npm dt](https://img.shields.io/npm/dt/@sentry/angular.svg)](https://www.npmjs.com/package/@sentry/angular)
12+
913
## Links
1014

1115
- [Official SDK Docs](https://docs.sentry.io/platforms/javascript/angular/)

packages/angular/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sentry/angular",
3-
"version": "7.41.0",
3+
"version": "7.43.0",
44
"description": "Official Sentry SDK for Angular",
55
"repository": "git://github.com/getsentry/sentry-javascript.git",
66
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/angular",
@@ -21,9 +21,9 @@
2121
"rxjs": "^6.5.5 || ^7.x"
2222
},
2323
"dependencies": {
24-
"@sentry/browser": "7.41.0",
25-
"@sentry/types": "7.41.0",
26-
"@sentry/utils": "7.41.0",
24+
"@sentry/browser": "7.43.0",
25+
"@sentry/types": "7.43.0",
26+
"@sentry/utils": "7.43.0",
2727
"tslib": "^2.0.0"
2828
},
2929
"devDependencies": {

packages/browser/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sentry/browser",
3-
"version": "7.41.0",
3+
"version": "7.43.0",
44
"description": "Official Sentry SDK for browsers",
55
"repository": "git://github.com/getsentry/sentry-javascript.git",
66
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/browser",
@@ -16,10 +16,10 @@
1616
"access": "public"
1717
},
1818
"dependencies": {
19-
"@sentry/core": "7.41.0",
20-
"@sentry/replay": "7.41.0",
21-
"@sentry/types": "7.41.0",
22-
"@sentry/utils": "7.41.0",
19+
"@sentry/core": "7.43.0",
20+
"@sentry/replay": "7.43.0",
21+
"@sentry/types": "7.43.0",
22+
"@sentry/utils": "7.43.0",
2323
"tslib": "^1.9.3"
2424
},
2525
"devDependencies": {

packages/browser/src/integrations/breadcrumbs.ts

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
22
/* eslint-disable max-lines */
33
import { getCurrentHub } from '@sentry/core';
4-
import type { Event, Integration } from '@sentry/types';
4+
import type { Event as SentryEvent, HandlerDataFetch, Integration, SentryWrappedXMLHttpRequest } from '@sentry/types';
55
import {
66
addInstrumentationHandler,
77
getEventDescription,
@@ -14,6 +14,8 @@ import {
1414

1515
import { WINDOW } from '../helpers';
1616

17+
type HandlerData = Record<string, unknown>;
18+
1719
/** JSDoc */
1820
interface BreadcrumbsOptions {
1921
console: boolean;
@@ -99,7 +101,7 @@ export class Breadcrumbs implements Integration {
99101
/**
100102
* Adds a breadcrumb for Sentry events or transactions if this option is enabled.
101103
*/
102-
public addSentryBreadcrumb(event: Event): void {
104+
public addSentryBreadcrumb(event: SentryEvent): void {
103105
if (this.options.sentry) {
104106
getCurrentHub().addBreadcrumb(
105107
{
@@ -120,10 +122,8 @@ export class Breadcrumbs implements Integration {
120122
* A HOC that creaes a function that creates breadcrumbs from DOM API calls.
121123
* This is a HOC so that we get access to dom options in the closure.
122124
*/
123-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
124-
function _domBreadcrumb(dom: BreadcrumbsOptions['dom']): (handlerData: { [key: string]: any }) => void {
125-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
126-
function _innerDomBreadcrumb(handlerData: { [key: string]: any }): void {
125+
function _domBreadcrumb(dom: BreadcrumbsOptions['dom']): (handlerData: HandlerData) => void {
126+
function _innerDomBreadcrumb(handlerData: HandlerData): void {
127127
let target;
128128
let keyAttrs = typeof dom === 'object' ? dom.serializeAttribute : undefined;
129129

@@ -143,9 +143,10 @@ function _domBreadcrumb(dom: BreadcrumbsOptions['dom']): (handlerData: { [key: s
143143

144144
// Accessing event.target can throw (see getsentry/raven-js#838, #768)
145145
try {
146-
target = handlerData.event.target
147-
? htmlTreeAsString(handlerData.event.target as Node, { keyAttrs, maxStringLength })
148-
: htmlTreeAsString(handlerData.event as unknown as Node, { keyAttrs, maxStringLength });
146+
const event = handlerData.event as Event | Node;
147+
target = _isEvent(event)
148+
? htmlTreeAsString(event.target, { keyAttrs, maxStringLength })
149+
: htmlTreeAsString(event, { keyAttrs, maxStringLength });
149150
} catch (e) {
150151
target = '<unknown>';
151152
}
@@ -173,8 +174,7 @@ function _domBreadcrumb(dom: BreadcrumbsOptions['dom']): (handlerData: { [key: s
173174
/**
174175
* Creates breadcrumbs from console API calls
175176
*/
176-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
177-
function _consoleBreadcrumb(handlerData: { [key: string]: any }): void {
177+
function _consoleBreadcrumb(handlerData: HandlerData & { args: unknown[]; level: string }): void {
178178
// This is a hack to fix a Vue3-specific bug that causes an infinite loop of
179179
// console warnings. This happens when a Vue template is rendered with
180180
// an undeclared variable, which we try to stringify, ultimately causing
@@ -216,8 +216,7 @@ function _consoleBreadcrumb(handlerData: { [key: string]: any }): void {
216216
/**
217217
* Creates breadcrumbs from XHR API calls
218218
*/
219-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
220-
function _xhrBreadcrumb(handlerData: { [key: string]: any }): void {
219+
function _xhrBreadcrumb(handlerData: HandlerData & { xhr: XMLHttpRequest & SentryWrappedXMLHttpRequest }): void {
221220
if (handlerData.endTimestamp) {
222221
// We only capture complete, non-sentry requests
223222
if (handlerData.xhr.__sentry_own_request__) {
@@ -249,8 +248,7 @@ function _xhrBreadcrumb(handlerData: { [key: string]: any }): void {
249248
/**
250249
* Creates breadcrumbs from fetch API calls
251250
*/
252-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
253-
function _fetchBreadcrumb(handlerData: { [key: string]: any }): void {
251+
function _fetchBreadcrumb(handlerData: HandlerData & HandlerDataFetch & { response?: Response }): void {
254252
// We only capture complete fetch requests
255253
if (!handlerData.endTimestamp) {
256254
return;
@@ -280,7 +278,7 @@ function _fetchBreadcrumb(handlerData: { [key: string]: any }): void {
280278
category: 'fetch',
281279
data: {
282280
...handlerData.fetchData,
283-
status_code: handlerData.response.status,
281+
status_code: handlerData.response && handlerData.response.status,
284282
},
285283
type: 'http',
286284
},
@@ -295,10 +293,9 @@ function _fetchBreadcrumb(handlerData: { [key: string]: any }): void {
295293
/**
296294
* Creates breadcrumbs from history API calls
297295
*/
298-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
299-
function _historyBreadcrumb(handlerData: { [key: string]: any }): void {
300-
let from = handlerData.from;
301-
let to = handlerData.to;
296+
function _historyBreadcrumb(handlerData: HandlerData & { from: string; to: string }): void {
297+
let from: string | undefined = handlerData.from;
298+
let to: string | undefined = handlerData.to;
302299
const parsedLoc = parseUrl(WINDOW.location.href);
303300
let parsedFrom = parseUrl(from);
304301
const parsedTo = parseUrl(to);
@@ -325,3 +322,7 @@ function _historyBreadcrumb(handlerData: { [key: string]: any }): void {
325322
},
326323
});
327324
}
325+
326+
function _isEvent(event: unknown): event is Event {
327+
return event && !!(event as Record<string, unknown>).target;
328+
}

packages/core/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sentry/core",
3-
"version": "7.41.0",
3+
"version": "7.43.0",
44
"description": "Base implementation for all Sentry JavaScript SDKs",
55
"repository": "git://github.com/getsentry/sentry-javascript.git",
66
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/core",
@@ -16,8 +16,8 @@
1616
"access": "public"
1717
},
1818
"dependencies": {
19-
"@sentry/types": "7.41.0",
20-
"@sentry/utils": "7.41.0",
19+
"@sentry/types": "7.43.0",
20+
"@sentry/utils": "7.43.0",
2121
"tslib": "^1.9.3"
2222
},
2323
"scripts": {

packages/core/src/baseclient.ts

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import type {
1717
SessionAggregates,
1818
Severity,
1919
SeverityLevel,
20+
Transaction,
2021
TransactionEvent,
2122
Transport,
2223
} from '@sentry/types';
@@ -97,6 +98,9 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
9798
/** Holds flushable */
9899
private _outcomes: { [key: string]: number } = {};
99100

101+
// eslint-disable-next-line @typescript-eslint/ban-types
102+
private _hooks: Record<string, Function[]> = {};
103+
100104
/**
101105
* Initializes this client instance.
102106
*
@@ -351,6 +355,38 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
351355
}
352356
}
353357

358+
// Keep on() & emit() signatures in sync with types' client.ts interface
359+
360+
/** @inheritdoc */
361+
public on(hook: 'startTransaction' | 'finishTransaction', callback: (transaction: Transaction) => void): void;
362+
363+
/** @inheritdoc */
364+
public on(hook: 'beforeEnvelope', callback: (envelope: Envelope) => void): void;
365+
366+
/** @inheritdoc */
367+
public on(hook: string, callback: unknown): void {
368+
if (!this._hooks[hook]) {
369+
this._hooks[hook] = [];
370+
}
371+
372+
// @ts-ignore We assue the types are correct
373+
this._hooks[hook].push(callback);
374+
}
375+
376+
/** @inheritdoc */
377+
public emit(hook: 'startTransaction' | 'finishTransaction', transaction: Transaction): void;
378+
379+
/** @inheritdoc */
380+
public emit(hook: 'beforeEnvelope', envelope: Envelope): void;
381+
382+
/** @inheritdoc */
383+
public emit(hook: string, ...rest: unknown[]): void {
384+
if (this._hooks[hook]) {
385+
// @ts-ignore we cannot enforce the callback to match the hook
386+
this._hooks[hook].forEach(callback => callback(...rest));
387+
}
388+
}
389+
354390
/** Updates existing session based on the provided event */
355391
protected _updateSessionFromEvent(session: Session, event: Event): void {
356392
let crashed = false;
@@ -560,7 +596,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
560596
data: {
561597
__sentry__: true,
562598
},
563-
originalException: reason as Error,
599+
originalException: reason,
564600
});
565601
throw new SentryError(
566602
`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${reason}`,

packages/core/src/hub.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@ export class Hub implements HubInterface {
183183
/**
184184
* @inheritDoc
185185
*/
186-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
187-
public captureException(exception: any, hint?: EventHint): string {
186+
public captureException(exception: unknown, hint?: EventHint): string {
188187
const eventId = (this._lastEventId = hint && hint.event_id ? hint.event_id : uuid4());
189188
const syntheticException = new Error('Sentry syntheticException');
190189
this._withClient((client, scope) => {

0 commit comments

Comments
 (0)