Skip to content

Commit d6f70fe

Browse files
committed
Merge branch 'develop' into cl/screenshot-integration
2 parents fc8b8c7 + 2333b3f commit d6f70fe

File tree

202 files changed

+2043
-2902
lines changed

Some content is hidden

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

202 files changed

+2043
-2902
lines changed

.craft.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ targets:
8989

9090
## 5. Node-based Packages
9191
- name: npm
92-
id: '@sentry/serverless'
93-
includeNames: /^sentry-serverless-\d.*\.tgz$/
92+
id: '@sentry/aws-serverless'
93+
includeNames: /^sentry-aws-serverless-\d.*\.tgz$/
9494
- name: npm
95-
id: '@sentry/google-cloud'
95+
id: '@sentry/google-cloud-serverless'
9696
includeNames: /^sentry-google-cloud-\d.*\.tgz$/
9797
- name: npm
9898
id: '@sentry/bun'

.github/CANARY_FAILURE_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
title: '{{ env.TITLE }}'
33
labels: 'Type: Tests, Waiting for: Product Owner'
44
---
5+
56
Canary tests failed: {{ env.RUN_LINK }}

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ body:
3434
- '@sentry/astro'
3535
- '@sentry/angular'
3636
- '@sentry/angular-ivy'
37+
- '@sentry/aws-serverless'
3738
- '@sentry/bun'
3839
- '@sentry/deno'
3940
- '@sentry/ember'
4041
- '@sentry/gatsby'
42+
- '@sentry/google-cloud-serverless'
4143
- '@sentry/nextjs'
4244
- '@sentry/node'
4345
- '@sentry/react'
4446
- '@sentry/remix'
45-
- '@sentry/serverless'
46-
- '@sentry/google-cloud'
4747
- '@sentry/svelte'
4848
- '@sentry/sveltekit'
4949
- '@sentry/vue'

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ jobs:
10211021
'sveltekit',
10221022
'sveltekit-2',
10231023
'generic-ts3.8',
1024-
'node-experimental-fastify-app',
1024+
'node-fastify-app',
10251025
# TODO(v8): Re-enable hapi tests
10261026
# 'node-hapi-app',
10271027
'node-exports-test-app',

MIGRATION.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ We've removed the following packages:
4848
- [@sentry/hub](./MIGRATION.md#sentryhub)
4949
- [@sentry/tracing](./MIGRATION.md#sentrytracing)
5050
- [@sentry/integrations](./MIGRATION.md#sentryintegrations)
51+
- [@sentry/serverless](./MIGRATION.md#sentryserverless)
5152

5253
#### @sentry/hub
5354

@@ -167,6 +168,55 @@ Integrations that are now exported from `@sentry/node` and `@sentry/browser` (or
167168

168169
The `Transaction` integration has been removed from `@sentry/integrations`. There is no replacement API.
169170

171+
#### @sentry/serverless
172+
173+
`@sentry/serverless` has been removed and will no longer be published. The serverless package has been split into two
174+
different packages, `@sentry/aws-serverless` and `@sentry/google-cloud-serverless`. These new packages have smaller
175+
bundle size than `@sentry/serverless`, which should improve your serverless cold-start times.
176+
177+
`@sentry/aws-serverless` and `@sentry/google-cloud-serverless` has also been changed to only emit CJS builds. The ESM
178+
build for the `@sentry/serverless` package was always broken and we decided to remove it entirely. ESM support will be
179+
re-added at a later date.
180+
181+
In `@sentry/serverless` you had to use a namespace import to initialize the SDK. This has been removed so that you can
182+
directly import from the SDK instead.
183+
184+
```js
185+
// v7
186+
const Sentry = require('@sentry/serverless');
187+
188+
Sentry.AWSLambda.init({
189+
dsn: '__DSN__',
190+
tracesSampleRate: 1.0,
191+
});
192+
193+
// v8
194+
const Sentry = require('@sentry/aws-serverless');
195+
196+
Sentry.init({
197+
dsn: '__DSN__',
198+
tracesSampleRate: 1.0,
199+
});
200+
```
201+
202+
```js
203+
// v7
204+
const Sentry = require('@sentry/serverless');
205+
206+
Sentry.GCPFunction.init({
207+
dsn: '__DSN__',
208+
tracesSampleRate: 1.0,
209+
});
210+
211+
// v8
212+
const Sentry = require('@sentry/google-cloud-serverless');
213+
214+
Sentry.init({
215+
dsn: '__DSN__',
216+
tracesSampleRate: 1.0,
217+
});
218+
```
219+
170220
## 3. Performance Monitoring Changes
171221

172222
- [Performance Monitoring API](./MIGRATION.md#performance-monitoring-api)
@@ -777,6 +827,51 @@ The SDK no longer filters out health check transactions by default. Instead, the
777827
by the Sentry backend by default. You can disable dropping them in your Sentry project settings. If you still want to
778828
drop specific transactions within the SDK you can either use the `ignoreTransactions` SDK option.
779829

830+
#### Change of Replay default options (`unblock` and `unmask`)
831+
832+
The Replay options `unblock` and `unmask` now have `[]` as default value. This means that if you want to use these
833+
options, you have to explicitly set them like this:
834+
835+
```js
836+
Sentry.init({
837+
integrations: [
838+
Sentry.replayIntegration({
839+
unblock: ['.sentry-unblock, [data-sentry-unblock]'],
840+
unmask: ['.sentry-unmask, [data-sentry-unmask]'],
841+
}),
842+
],
843+
});
844+
```
845+
846+
#### Angular Tracing Decorator renaming
847+
848+
The usage of `TraceClassDecorator` and the `TraceMethodDecorator` already implies that those are decorators. The word
849+
`Decorator` is now removed from the names to avoid multiple mentioning.
850+
851+
Additionally, the `TraceClass` and `TraceMethod` decorators accept an optional `name` parameter to set the transaction
852+
name. This was added because Angular minifies class and method names, and you might want to set a more descriptive name.
853+
If nothing provided, the name defaults to `'unnamed'`.
854+
855+
```js
856+
// v7
857+
@Sentry.TraceClassDecorator()
858+
export class HeaderComponent {
859+
@Sentry.TraceMethodDecorator()
860+
ngOnChanges(changes: SimpleChanges) {}
861+
}
862+
```
863+
864+
```js
865+
// v8
866+
@Sentry.TraceClass({ name: 'HeaderComponent' })
867+
export class HeaderComponent {
868+
@Sentry.TraceMethod({ name: 'ngOnChanges' })
869+
ngOnChanges(changes: SimpleChanges) {}
870+
}
871+
```
872+
873+
---
874+
780875
# Deprecations in 7.x
781876

782877
You can use the **Experimental** [@sentry/migr8](https://www.npmjs.com/package/@sentry/migr8) to automatically update

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ package. Please refer to the README and instructions of those SDKs for more deta
5757
- [`@sentry/gatsby`](https://github.com/getsentry/sentry-javascript/tree/master/packages/gatsby): SDK for Gatsby
5858
- [`@sentry/nextjs`](https://github.com/getsentry/sentry-javascript/tree/master/packages/nextjs): SDK for Next.js
5959
- [`@sentry/remix`](https://github.com/getsentry/sentry-javascript/tree/master/packages/remix): SDK for Remix
60-
- [`@sentry/serverless`](https://github.com/getsentry/sentry-javascript/tree/master/packages/serverless): SDK for
61-
Serverless Platforms (AWS, GCP)
60+
- [`@sentry/aws-serverless`](https://github.com/getsentry/sentry-javascript/tree/master/packages/aws-serverless): SDK
61+
for AWS Lambda Functions
62+
- [`@sentry/google-cloud-serverless`](https://github.com/getsentry/sentry-javascript/tree/master/packages/google-cloud):
63+
SDK for Google Cloud Functions
6264
- [`@sentry/electron`](https://github.com/getsentry/sentry-electron): SDK for Electron with support for native crashes
6365
- [`@sentry/react-native`](https://github.com/getsentry/sentry-react-native): SDK for React Native with support for
6466
native crashes

dev-packages/browser-integration-tests/README.md

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
# Integration Tests for Sentry Browser SDK
22

3-
Integration tests for Sentry's Browser SDK use [Playwright](https://playwright.dev/) internally. These tests are run on latest stable versions of Chromium, Firefox and Webkit.
3+
Integration tests for Sentry's Browser SDK use [Playwright](https://playwright.dev/) internally. These tests are run on
4+
latest stable versions of Chromium, Firefox and Webkit.
45

56
## Structure
67

7-
The tests are grouped by their scope such as `breadcrumbs` or `onunhandledrejection`. In every group of tests, there are multiple folders containing test cases with their optional supporting assets.
8+
The tests are grouped by their scope such as `breadcrumbs` or `onunhandledrejection`. In every group of tests, there are
9+
multiple folders containing test cases with their optional supporting assets.
810

9-
Each case group has a default HTML skeleton named `template.hbs`, and also a default initialization script named `init.js `, which contains the `Sentry.init()` call. These defaults are used as fallbacks when a specific `template.hbs` or `init.js` is not defined in a case folder.
11+
Each case group has a default HTML skeleton named `template.hbs`, and also a default initialization script named
12+
`init.js `, which contains the `Sentry.init()` call. These defaults are used as fallbacks when a specific `template.hbs`
13+
or `init.js` is not defined in a case folder.
1014

11-
`subject.js` contains the logic that sets up the environment to be tested. It also can be defined locally and as a group fallback. Unlike `template.hbs` and `init.js`, it's not required to be defined for a group, as there may be cases that does not require a subject, instead the logic is injected using `injectScriptAndGetEvents` from `utils/helpers.ts`.
15+
`subject.js` contains the logic that sets up the environment to be tested. It also can be defined locally and as a group
16+
fallback. Unlike `template.hbs` and `init.js`, it's not required to be defined for a group, as there may be cases that
17+
does not require a subject, instead the logic is injected using `injectScriptAndGetEvents` from `utils/helpers.ts`.
1218

13-
`test.ts` is required for each test case, which contains the assertions (and if required the script injection logic). For every case, any set of `init.js`, `template.hbs` and `subject.js` can be defined locally, and each one of them will have precedence over the default definitions of the test group.
19+
`test.ts` is required for each test case, which contains the assertions (and if required the script injection logic).
20+
For every case, any set of `init.js`, `template.hbs` and `subject.js` can be defined locally, and each one of them will
21+
have precedence over the default definitions of the test group.
1422

15-
To test page multi-page navigations, you can specify additional `page-*.html` (e.g. `page-0.html`, `page-1.html`) files. These will also be compiled and initialized with the same `init.js` and `subject.js` files that are applied to `template.hbs/html`. Note: `page-*.html` file lookup **doesn not** fall back to the
16-
parent directories, meaning that page files have to be directly in the `test.ts` directory.
23+
To test page multi-page navigations, you can specify additional `page-*.html` (e.g. `page-0.html`, `page-1.html`) files.
24+
These will also be compiled and initialized with the same `init.js` and `subject.js` files that are applied to
25+
`template.hbs/html`. Note: `page-*.html` file lookup **doesn not** fall back to the parent directories, meaning that
26+
page files have to be directly in the `test.ts` directory.
1727

1828
```
1929
suites/
@@ -33,11 +43,16 @@ suites/
3343

3444
### Helpers
3545

36-
`utils/helpers.ts` contains helpers that could be used in assertions (`test.ts`). These helpers define a convenient and reliable API to interact with Playwright's native API. It's highly recommended to define all common patterns of Playwright usage in helpers.
46+
`utils/helpers.ts` contains helpers that could be used in assertions (`test.ts`). These helpers define a convenient and
47+
reliable API to interact with Playwright's native API. It's highly recommended to define all common patterns of
48+
Playwright usage in helpers.
3749

3850
### Fixtures
3951

40-
[Fixtures](https://playwright.dev/docs/api/class-fixtures) allows us to define the globals and test-specific information in assertion groups (`test.ts` files). In it's current state, `fixtures.ts` contains an extension over the pure version of `test()` function of Playwright. All the tests should import `sentryTest` function from `utils/fixtures.ts` instead of `@playwright/test` to be able to access the extra fixtures.
52+
[Fixtures](https://playwright.dev/docs/api/class-fixtures) allows us to define the globals and test-specific information
53+
in assertion groups (`test.ts` files). In it's current state, `fixtures.ts` contains an extension over the pure version
54+
of `test()` function of Playwright. All the tests should import `sentryTest` function from `utils/fixtures.ts` instead
55+
of `@playwright/test` to be able to access the extra fixtures.
4156

4257
## Running Tests Locally
4358

@@ -47,8 +62,7 @@ Tests can be run locally using the latest version of Chromium with:
4762

4863
To run tests with a different browser such as `firefox` or `webkit`:
4964

50-
`yarn test --project='firefox'`
51-
`yarn test --project='webkit'`
65+
`yarn test --project='firefox'` `yarn test --project='webkit'`
5266

5367
Or to run on all three browsers:
5468

@@ -60,18 +74,27 @@ To filter tests by their title:
6074

6175
You can refer to [Playwright documentation](https://playwright.dev/docs/test-cli) for other CLI options.
6276

63-
You can set env variable `PW_BUNDLE` to set specific build or bundle to test against.
64-
Available options: `esm`, `cjs`, `bundle`, `bundle_min`
77+
You can set env variable `PW_BUNDLE` to set specific build or bundle to test against. Available options: `esm`, `cjs`,
78+
`bundle`, `bundle_min`
6579

6680
### Troubleshooting
6781

68-
Apart from [Playwright-specific issues](https://playwright.dev/docs/troubleshooting), below are common issues that might occur while writing tests for Sentry Browser SDK.
82+
Apart from [Playwright-specific issues](https://playwright.dev/docs/troubleshooting), below are common issues that might
83+
occur while writing tests for Sentry Browser SDK.
6984

7085
- #### Flaky Tests
71-
If a test fails randomly, giving a `Page Closed`, `Target Closed` or a similar error, most of the times, the reason is a race condition between the page action defined in the `subject` and the listeners of the Sentry event / request. It's recommended to firstly check `utils/helpers.ts` whether if that async logic can be replaced by one of the helpers. If not, whether the awaited (or non-awaited on purpose in some cases) Playwright methods can be orchestrated by [`Promise.all`](http://mdn.io/promise.all). Manually-defined waiting logic such as timeouts are not recommended, and should not be required in most of the cases.
86+
87+
If a test fails randomly, giving a `Page Closed`, `Target Closed` or a similar error, most of the times, the reason is
88+
a race condition between the page action defined in the `subject` and the listeners of the Sentry event / request.
89+
It's recommended to firstly check `utils/helpers.ts` whether if that async logic can be replaced by one of the
90+
helpers. If not, whether the awaited (or non-awaited on purpose in some cases) Playwright methods can be orchestrated
91+
by [`Promise.all`](http://mdn.io/promise.all). Manually-defined waiting logic such as timeouts are not recommended,
92+
and should not be required in most of the cases.
7293

7394
- #### Build Errors
74-
Before running, a page for each test case is built under the case folder inside `dist`. If a page build is failed, it's recommended to check:
95+
96+
Before running, a page for each test case is built under the case folder inside `dist`. If a page build is failed,
97+
it's recommended to check:
7598

7699
- If both default `template.hbs` and `init.js` are defined for the test group.
77100
- If a `subject.js` is defined for the test case.

dev-packages/browser-integration-tests/suites/replay/customEvents/init.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ window.Replay = Sentry.replayIntegration({
77
minReplayDuration: 0,
88
useCompression: false,
99
blockAllMedia: false,
10+
unmask: ['.sentry-unmask, [data-sentry-unmask]'],
1011
});
1112

1213
Sentry.init({

dev-packages/browser-integration-tests/suites/replay/privacyBlock/init.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ window.Replay = Sentry.replayIntegration({
88
useCompression: false,
99
blockAllMedia: false,
1010
block: ['link[rel="icon"]', 'video', '.nested-hide'],
11+
unmask: ['.sentry-unmask, [data-sentry-unmask]'],
1112
});
1213

1314
Sentry.init({

dev-packages/browser-integration-tests/suites/replay/privacyDefault/template.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
<body>
88
<button aria-label="Click me" onclick="console.log('Test log')">Click me</button>
99
<div>This should be masked by default</div>
10-
<div data-sentry-unmask>This should be unmasked due to data attribute</div>
10+
<div data-sentry-unmask>With default settings, this should also be masked (even with data attribute)</div>
1111
<input placeholder="Placeholder should be masked" />
12-
<input data-sentry-unmask placeholder="Placeholder can be unmasked" />
12+
<input data-sentry-unmask placeholder="Placeholder can be unmasked - but not with default settings" />
1313
<div title="Title should be masked">Title should be masked</div>
1414
<svg style="width:200px;height:200px" viewBox="0 0 80 80"><path d=""/><area /><rect /></svg>
1515
<svg style="width:200px;height:200px" viewBox="0 0 80 80" data-sentry-unblock><path d=""/><area /><rect /></svg>

0 commit comments

Comments
 (0)