Skip to content

Commit

Permalink
Merge branch 'develop' into chdsbd/mark-error-handler-errors-unhandled
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhiPrasad authored Jun 30, 2023
2 parents 6f7e66c + cf8c072 commit ef053f8
Show file tree
Hide file tree
Showing 326 changed files with 5,648 additions and 2,851 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
82 changes: 82 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,88 @@

- "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)
- feat(replay): Stop replay when event buffer exceeds max. size (#8315)
- feat(replay): Consider `window.open` for slow clicks (#8308)
- fix(core): Temporarily store debug IDs in stack frame and only put them into `debug_meta` before sending (#8347)
- fix(remix): Extract deferred responses correctly in root loaders. (#8305)
- fix(vue): Don't call `next` in Vue router 4 instrumentation (#8351)

## 7.55.2

- fix(replay): Stop exporting `EventType` from `@sentry-internal/rrweb` (#8334)
- fix(serverless): Export captureCheckIn (#8333)

## 7.55.1

- fix(replay): Do not export types from `@sentry-internal/rrweb` (#8329)

## 7.55.0

- feat(replay): Capture slow clicks (GA) (#8298)
- feat(replay): Improve types for replay recording events (#8224)
- fix(nextjs): Strip query params from transaction names of navigations to unknown routes (#8278)
- fix(replay): Ignore max session life for buffered sessions (#8258)
- fix(sveltekit): Export captureCheckIn (#8313)
- ref(svelte): Add Svelte 4 as a peer dependency (#8280)

## 7.54.0

### Important Changes
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "7.54.0",
"version": "7.57.0",
"npmClient": "yarn",
"useWorkspaces": true
}
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
11 changes: 5 additions & 6 deletions packages/angular-ivy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry/angular-ivy",
"version": "7.54.0",
"version": "7.57.0",
"description": "Official Sentry SDK for Angular with full Ivy Support",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/angular-ivy",
Expand All @@ -21,10 +21,10 @@
"rxjs": "^6.5.5 || ^7.x"
},
"dependencies": {
"@sentry/browser": "7.54.0",
"@sentry/types": "7.54.0",
"@sentry/utils": "7.54.0",
"tslib": "^2.3.0"
"@sentry/browser": "7.57.0",
"@sentry/types": "7.57.0",
"@sentry/utils": "7.57.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
12 changes: 6 additions & 6 deletions packages/angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry/angular",
"version": "7.54.0",
"version": "7.57.0",
"description": "Official Sentry SDK for Angular",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/angular",
Expand All @@ -21,10 +21,10 @@
"rxjs": "^6.5.5 || ^7.x"
},
"dependencies": {
"@sentry/browser": "7.54.0",
"@sentry/types": "7.54.0",
"@sentry/utils": "7.54.0",
"tslib": "^2.0.0"
"@sentry/browser": "7.57.0",
"@sentry/types": "7.57.0",
"@sentry/utils": "7.57.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
Loading

0 comments on commit ef053f8

Please sign in to comment.