Skip to content

Commit

Permalink
Merge pull request #8417 from getsentry/prepare-release/7.57.0
Browse files Browse the repository at this point in the history
meta(changelog): Update Changelog for 7.57.0
  • Loading branch information
mydea authored Jun 28, 2023
2 parents 6afd3e0 + 4d87498 commit f874586
Show file tree
Hide file tree
Showing 268 changed files with 3,342 additions and 2,237 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ jobs:
- 'scripts/**'
- 'packages/core/**'
- 'packages/tracing/**'
- 'packages/tracing-internal/**'
- 'packages/utils/**'
- 'packages/types/**'
- 'packages/integrations/**'
Expand Down Expand Up @@ -424,7 +425,7 @@ jobs:
name: Nextjs (Node ${{ matrix.node }}) Tests
needs: [job_get_metadata, job_build]
if: needs.job_get_metadata.outputs.changed_nextjs == 'true' || github.event_name != 'pull_request'
timeout-minutes: 15
timeout-minutes: 25
runs-on: ubuntu-20.04
strategy:
fail-fast: false
Expand Down Expand Up @@ -654,7 +655,9 @@ jobs:
yarn test:package
job_node_integration_tests:
name: Node (${{ matrix.node }}) Integration Tests
name:
Node (${{ matrix.node }})${{ (matrix.typescript && format(' (TS {0})', matrix.typescript)) || '' }} Integration
Tests
needs: [job_get_metadata, job_build]
if: needs.job_get_metadata.outputs.changed_node == 'true' || github.event_name != 'pull_request'
runs-on: ubuntu-20.04
Expand All @@ -663,6 +666,12 @@ jobs:
fail-fast: false
matrix:
node: [10, 12, 14, 16, 18, 20]
typescript:
- false
include:
# Only check typescript for latest version (to streamline CI)
- node: 20
typescript: '3.8'
steps:
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
uses: actions/checkout@v3
Expand All @@ -676,6 +685,11 @@ jobs:
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}

- name: Overwrite typescript version
if: matrix.typescript
run: yarn add --dev --ignore-workspace-root-check typescript@${{ matrix.typescript }}

- name: Run integration tests
env:
NODE_VERSION: ${{ matrix.node }}
Expand All @@ -684,7 +698,7 @@ jobs:
yarn test
job_remix_integration_tests:
name: Remix (Node ${{ matrix.node }}) Tests
name: Remix v${{ matrix.remix }} (Node ${{ matrix.node }}) Tests
needs: [job_get_metadata, job_build]
if: needs.job_get_metadata.outputs.changed_remix == 'true' || github.event_name != 'pull_request'
runs-on: ubuntu-20.04
Expand All @@ -693,6 +707,7 @@ jobs:
fail-fast: false
matrix:
node: [14, 16, 18]
remix: [1, 2]
steps:
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
uses: actions/checkout@v3
Expand All @@ -709,12 +724,13 @@ jobs:
- name: Run integration tests
env:
NODE_VERSION: ${{ matrix.node }}
REMIX_VERSION: ${{ matrix.remix }}
run: |
cd packages/remix
yarn test:integration:ci
job_e2e_tests:
name: E2E Tests (Shard ${{ matrix.shard }})
name: E2E (Shard ${{ matrix.shard }}) Tests
# We only run E2E tests for non-fork PRs because the E2E tests require secrets to work and they can't be accessed from forks
# Dependabot PRs sadly also don't have access to secrets, so we skip them as well
if:
Expand All @@ -727,6 +743,7 @@ jobs:
fail-fast: false
matrix:
shard: [1, 2, 3]

steps:
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
uses: actions/checkout@v3
Expand All @@ -743,6 +760,7 @@ jobs:
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}

- name: Get node version
id: versions
run: |
Expand Down
55 changes: 55 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,61 @@

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

## 7.57.0

### Important Changes

- **build: Update typescript from 3.8.3 to 4.9.5 (#8255)**

This release version [bumps the internally used typescript version from 3.8.x to 4.9.x](https://github.com/getsentry/sentry-javascript/pull/8255).
We use ds-downlevel to generate two versions of our types, one for >=3.8, one for >=4.9.
This means that this change should be fully backwards compatible and not have any noticable user impact,
but if you still encounter issues please let us know.

- **feat(types): Add tracePropagationTargets to top level options (#8395)**

Instead of passing `tracePropagationTargets` to the `BrowserTracing` integration, you can now define them on the top level:

```js
Sentry.init({
tracePropagationTargets: ['api.site.com'],
});
```

- **fix(angular): Filter out `TryCatch` integration by default (#8367)**

The Angular and Angular-ivy SDKs will not install the TryCatch integration anymore by default.
This integration conflicted with the `SentryErrorHander`, sometimes leading to duplicated errors and/or missing data on events.

- **feat(browser): Better event name handling for non-Error objects (#8374)**

When capturing non-errors via `Sentry.captureException()`, e.g. `Sentry.captureException({ prop: "custom object" })`,
we now generate a more helpful value for the synthetic exception. Instead of e.g. `Non-Error exception captured with keys: currentTarget, isTrusted, target, type`, you'll now get messages like:

```
Object captured as exception with keys: prop1, prop2
Event `MouseEvent` (type=click) captured as exception
Event `ErrorEvent` captured as exception with message `Script error.`
```

### Other Changes

- feat(browser): Send profiles in same envelope as transactions (#8375)
- feat(profiling): Collect timings on profiler stop calls (#8409)
- feat(replay): Do not capture replays < 5 seconds (GA) (#8277)
- feat(tracing): Add experiment to capture http timings (#8371)
- feat(tracing): Add `http.response.status_code` to `span.data` (#8366)
- fix(angular): Stop routing spans on navigation cancel and error events (#8369)
- fix(core): Only start spans in `trace` if tracing is enabled (#8357)
- fix(nextjs): Inject init calls via loader instead of via entrypoints (#8368)
- fix(replay): Mark ui.slowClickDetected `clickCount` as optional (#8376)
- fix(serverless): Export `autoDiscoverNodePerformanceMonitoringIntegrations` from SDK (#8382)
- fix(sveltekit): Check for cached requests in client-side fetch instrumentation (#8391)
- fix(sveltekit): Only instrument SvelteKit `fetch` if the SDK client is valid (#8381)
- fix(tracing): Instrument Prisma client in constructor of integration (#8383)
- ref(replay): More graceful `sessionStorage` check (#8394)
- ref(replay): Remove circular dep in replay eventBuffer (#8389)

## 7.56.0

- feat(replay): Rework slow click & multi click detection (#8322)
Expand Down
4 changes: 3 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@
],
"outputs": [
"{projectRoot}/build/types",
"{projectRoot}/build/npm/types"
"{projectRoot}/build/types-ts3.8",
"{projectRoot}/build/npm/types",
"{projectRoot}/build/npm/types-ts3.8"
]
},
"lint:eslint": {
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"chai": "^4.1.2",
"codecov": "^3.6.5",
"deepmerge": "^4.2.2",
"downlevel-dts": "~0.11.0",
"es-check": "7.1.0",
"eslint": "7.32.0",
"jest": "^27.5.1",
Expand All @@ -114,9 +115,9 @@
"size-limit": "^4.5.5",
"ts-jest": "^27.1.4",
"ts-node": "10.9.1",
"tslib": "^2.3.1",
"tslib": "2.4.1",
"typedoc": "^0.18.0",
"typescript": "3.8.3",
"typescript": "4.9.5",
"vitest": "^0.29.2",
"yalc": "^1.0.0-pre.53"
},
Expand Down
3 changes: 1 addition & 2 deletions packages/angular-ivy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@sentry/browser": "7.56.0",
"@sentry/types": "7.56.0",
"@sentry/utils": "7.56.0",
"tslib": "^2.3.0"
"tslib": "^2.4.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~12.2.18",
Expand All @@ -37,7 +37,6 @@
"@angular/platform-browser-dynamic": "~12.2.0",
"@angular/router": "~12.2.0",
"ng-packagr": "^12.1.1",
"typescript": "~4.3.5",
"zone.js": "~0.11.4"
},
"scripts": {
Expand Down
14 changes: 13 additions & 1 deletion packages/angular-ivy/src/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { VERSION } from '@angular/core';
import type { BrowserOptions } from '@sentry/browser';
import { init as browserInit, SDK_VERSION, setContext } from '@sentry/browser';
import { defaultIntegrations, init as browserInit, SDK_VERSION, setContext } from '@sentry/browser';
import { logger } from '@sentry/utils';

import { IS_DEBUG_BUILD } from './flags';
Expand All @@ -21,6 +21,18 @@ export function init(options: BrowserOptions): void {
version: SDK_VERSION,
};

// Filter out TryCatch integration as it interferes with our Angular `ErrorHandler`:
// TryCatch would catch certain errors before they reach the `ErrorHandler` and thus provide a
// lower fidelity error than what `SentryErrorHandler` (see errorhandler.ts) would provide.
// see:
// - https://github.com/getsentry/sentry-javascript/issues/5417#issuecomment-1453407097
// - https://github.com/getsentry/sentry-javascript/issues/2744
if (options.defaultIntegrations === undefined) {
options.defaultIntegrations = defaultIntegrations.filter(integration => {
return integration.name !== 'TryCatch';
});
}

checkAndSetAngularVersion();
browserInit(options);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@sentry/browser": "7.56.0",
"@sentry/types": "7.56.0",
"@sentry/utils": "7.56.0",
"tslib": "^2.0.0"
"tslib": "^2.4.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1002.4",
Expand All @@ -38,7 +38,7 @@
"@angular/router": "~10.2.5",
"ng-packagr": "^10.1.0",
"rxjs": "6.5.5",
"typescript": "~4.0.2",
"typescript": "4.0.2",
"zone.js": "^0.11.8"
},
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions packages/angular/src/errorhandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { HttpErrorResponse } from '@angular/common/http';
import type { ErrorHandler as AngularErrorHandler } from '@angular/core';
import { Inject, Injectable } from '@angular/core';
import * as Sentry from '@sentry/browser';
import { captureException } from '@sentry/browser';
import type { Event, Scope } from '@sentry/types';
import { addExceptionMechanism, isString } from '@sentry/utils';

import { runOutsideAngular } from './zone';
Expand Down Expand Up @@ -101,7 +101,7 @@ class SentryErrorHandler implements AngularErrorHandler {

// Capture handled exception and send it to Sentry.
const eventId = runOutsideAngular(() =>
captureException(extractedError, scope => {
Sentry.captureException(extractedError, (scope: Scope) => {
scope.addEventProcessor(event => {
addExceptionMechanism(event, {
type: 'angular',
Expand All @@ -126,7 +126,7 @@ class SentryErrorHandler implements AngularErrorHandler {
const client = Sentry.getCurrentHub().getClient();

if (client && client.on && !this._registeredAfterSendEventHandler) {
client.on('afterSendEvent', event => {
client.on('afterSendEvent', (event: Event) => {
if (!event.type) {
Sentry.showReportDialog({ ...this._options.dialogOptions, eventId: event.event_id });
}
Expand Down
14 changes: 13 additions & 1 deletion packages/angular/src/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { VERSION } from '@angular/core';
import type { BrowserOptions } from '@sentry/browser';
import { init as browserInit, SDK_VERSION, setContext } from '@sentry/browser';
import { defaultIntegrations, init as browserInit, SDK_VERSION, setContext } from '@sentry/browser';
import { logger } from '@sentry/utils';

import { IS_DEBUG_BUILD } from './flags';
Expand All @@ -21,6 +21,18 @@ export function init(options: BrowserOptions): void {
version: SDK_VERSION,
};

// Filter out TryCatch integration as it interferes with our Angular `ErrorHandler`:
// TryCatch would catch certain errors before they reach the `ErrorHandler` and thus provide a
// lower fidelity error than what `SentryErrorHandler` (see errorhandler.ts) would provide.
// see:
// - https://github.com/getsentry/sentry-javascript/issues/5417#issuecomment-1453407097
// - https://github.com/getsentry/sentry-javascript/issues/2744
if (options.defaultIntegrations === undefined) {
options.defaultIntegrations = defaultIntegrations.filter(integration => {
return integration.name !== 'TryCatch';
});
}

checkAndSetAngularVersion();
browserInit(options);
}
Expand Down
6 changes: 4 additions & 2 deletions packages/angular/src/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { ActivatedRouteSnapshot, Event, RouterState } from '@angular/router
// Duplicated import to work around a TypeScript bug where it'd complain that `Router` isn't imported as a type.
// We need to import it as a value to satisfy Angular dependency injection. So:
// eslint-disable-next-line @typescript-eslint/consistent-type-imports, import/no-duplicates
import { Router } from '@angular/router';
import { NavigationCancel, NavigationError, Router } from '@angular/router';
// eslint-disable-next-line import/no-duplicates
import { NavigationEnd, NavigationStart, ResolveEnd } from '@angular/router';
import { getCurrentHub, WINDOW } from '@sentry/browser';
Expand Down Expand Up @@ -131,7 +131,9 @@ export class TraceService implements OnDestroy {
);

public navEnd$: Observable<Event> = this._router.events.pipe(
filter(event => event instanceof NavigationEnd),
filter(
event => event instanceof NavigationEnd || event instanceof NavigationCancel || event instanceof NavigationError,
),
tap(() => {
if (this._routingSpan) {
runOutsideAngular(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/test/errorhandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('SentryErrorHandler', () => {
describe('handleError method', () => {
it('handleError method assigns the correct mechanism', () => {
const addEventProcessorSpy = jest.spyOn(FakeScope, 'addEventProcessor').mockImplementationOnce(callback => {
void callback({}, { event_id: 'fake-event-id' });
void (callback as (event: any, hint: any) => void)({}, { event_id: 'fake-event-id' });
return FakeScope;
});

Expand Down
31 changes: 30 additions & 1 deletion packages/angular/test/sdk.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as SentryBrowser from '@sentry/browser';

import { init } from '../src/sdk';
import { defaultIntegrations, init } from '../src/index';

describe('init', () => {
it('sets the Angular version (if available) in the global scope', () => {
Expand All @@ -13,4 +13,33 @@ describe('init', () => {
expect(setContextSpy).toHaveBeenCalledTimes(1);
expect(setContextSpy).toHaveBeenCalledWith('angular', { version: 10 });
});

describe('filtering out the `TryCatch` integration', () => {
const browserInitSpy = jest.spyOn(SentryBrowser, 'init');

beforeEach(() => {
browserInitSpy.mockClear();
});

it('filters if `defaultIntegrations` is not set', () => {
init({});

expect(browserInitSpy).toHaveBeenCalledTimes(1);

const options = browserInitSpy.mock.calls[0][0] || {};
expect(options.defaultIntegrations).not.toContainEqual(expect.objectContaining({ name: 'TryCatch' }));
});

it.each([false as const, defaultIntegrations])(
"doesn't filter if `defaultIntegrations` is set to %s",
defaultIntegrations => {
init({ defaultIntegrations });

expect(browserInitSpy).toHaveBeenCalledTimes(1);

const options = browserInitSpy.mock.calls[0][0] || {};
expect(options.defaultIntegrations).toEqual(defaultIntegrations);
},
);
});
});
Loading

0 comments on commit f874586

Please sign in to comment.