Skip to content

Commit f51c7d0

Browse files
authored
Merge pull request #12615 from getsentry/prepare-release/8.12.0
meta(changelog): Update changelog for 8.12.0
2 parents 49b0ce0 + 6f9d57c commit f51c7d0

File tree

85 files changed

+4268
-265
lines changed

Some content is hidden

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

85 files changed

+4268
-265
lines changed

CHANGELOG.md

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

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

7+
## 8.12.0
8+
9+
### Important Changes
10+
11+
- **feat(core): Return client from init method (#12585)**
12+
13+
`Sentry.init()` now returns a client directly, so you don't need to explicitly call `getClient()` anymore:
14+
15+
```js
16+
const client = Sentry.init();
17+
```
18+
19+
- **feat(nextjs): Add `deleteSourcemapsAfterUpload` option (#12457)**
20+
21+
This adds an easy way to delete sourcemaps immediately after uploading them:
22+
23+
```js
24+
module.exports = withSentryConfig(nextConfig, {
25+
sourcemaps: {
26+
deleteSourcemapsAfterUpload: true,
27+
},
28+
});
29+
```
30+
31+
### Other Changes
32+
33+
- feat(feedback): Extra check for iPad in screenshot support (#12593)
34+
- fix(bundle): Ensure CDN bundles do not overwrite `window.Sentry` (#12580)
35+
- ref(node): Add error message to NodeFetch log (#12612)
36+
37+
Work in this release was contributed by @n4bb12. Thank you for your contribution!
38+
739
## 8.11.0
840

941
### Important Changes
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
window.sentryOnLoad = function () {
2+
Sentry.init({});
3+
4+
window.__sentryLoaded = true;
5+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Sentry.forceLoad();
2+
3+
Sentry.captureException('Test exception');
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<script>
6+
window.Sentry = {_customThingOnSentry: 'customThingOnSentry' };
7+
</script>
8+
</head>
9+
<body></body>
10+
</html>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { expect } from '@playwright/test';
2+
3+
import { sentryTest } from '../../../../utils/fixtures';
4+
import { envelopeRequestParser, waitForErrorRequestOnUrl } from '../../../../utils/helpers';
5+
6+
sentryTest('keeps data on window.Sentry intact', async ({ getLocalTestUrl, page }) => {
7+
await page.route('https://dsn.ingest.sentry.io/**/*', route => {
8+
return route.fulfill({
9+
status: 200,
10+
contentType: 'application/json',
11+
body: JSON.stringify({ id: 'test-id' }),
12+
});
13+
});
14+
15+
const url = await getLocalTestUrl({ testDir: __dirname });
16+
const req = await waitForErrorRequestOnUrl(page, url);
17+
18+
const eventData = envelopeRequestParser(req);
19+
20+
expect(eventData.message).toBe('Test exception');
21+
22+
const customThingy = await page.evaluate('window.Sentry._customThingOnSentry');
23+
expect(customThingy).toBe('customThingOnSentry');
24+
});

dev-packages/e2e-tests/test-applications/nextjs-app-dir/assert-build.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as fs from 'fs';
2+
import * as path from 'path';
23
import * as assert from 'assert/strict';
34

45
const packageJson = require('./package.json');
@@ -20,4 +21,11 @@ assert.match(buildStdout, /(λ|ƒ) \/server-component/);
2021
assert.match(buildStdout, /(λ|ƒ) \/server-component\/parameter\/\[\.\.\.parameters\]/);
2122
assert.match(buildStdout, /(λ|ƒ) \/server-component\/parameter\/\[parameter\]/);
2223

24+
// Read the contents of the directory
25+
const files = fs.readdirSync(path.join(process.cwd(), '.next', 'server'));
26+
const mapFiles = files.filter(file => path.extname(file) === '.map');
27+
if (mapFiles.length > 0) {
28+
throw new Error('.map files found even though `sourcemaps.deleteSourcemapsAfterUpload` option is set!');
29+
}
30+
2331
export {};

dev-packages/e2e-tests/test-applications/nextjs-app-dir/next.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ const nextConfig = {
99
};
1010

1111
module.exports = withSentryConfig(nextConfig, {
12-
silent: true,
12+
debug: true,
13+
sourcemaps: {
14+
deleteSourcemapsAfterUpload: true,
15+
},
1316
});

dev-packages/e2e-tests/verdaccio-config/config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ packages:
170170
unpublish: $all
171171
# proxy: npmjs # Don't proxy for E2E tests!
172172

173+
'@sentry/nuxt':
174+
access: $all
175+
publish: $all
176+
unpublish: $all
177+
# proxy: npmjs # Don't proxy for E2E tests!
178+
173179
'@sentry/wasm':
174180
access: $all
175181
publish: $all

dev-packages/rollup-utils/bundleHelpers.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ export function makeBaseBundleConfig(options) {
4848
output: {
4949
format: 'iife',
5050
name: 'Sentry',
51+
intro: () => {
52+
return 'exports = window.Sentry || {};';
53+
},
5154
},
5255
context: 'window',
5356
plugins: [rrwebBuildPlugin, markAsBrowserBuildPlugin],

docs/commit-issue-pr-guidelines.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ and committed as such onto `develop`.
2929
- Make sure to rebase the branch on `develop` before squashing it
3030
- Make sure to update the commit message of the squashed branch to follow the commit guidelines - including the PR
3131
number
32+
- If you are a Sentry employee, assign yourself to the PR
3233

3334
Please note that we cannot _enforce_ Squash Merge due to the usage of Gitflow (see below). Github remembers the last
3435
used merge method, so you'll need to make sure to double check that you are using "Squash and Merge" correctly.

docs/gitflow.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@ We use [Gitflow](https://docs.github.com/en/get-started/quickstart/github-flow)
1212
- Never merge directly into `master` (unless we want e.g. an emergency bugfix release)
1313

1414
![gitflow-chart](./assets/gitflow-chart.png)
15+
16+
## Important Caveats
17+
18+
While a release is pending, we may merge anything into develop, **except for changes to package.json files**. If we
19+
change the package.json files on develop, the gitflow PR master -> develop will have merge conflicts, because during the
20+
release the package.json files are updated on master.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"packages/integration-shims",
6363
"packages/nextjs",
6464
"packages/node",
65+
"packages/nuxt",
6566
"packages/opentelemetry",
6667
"packages/profiling-node",
6768
"packages/react",

packages/angular/src/sdk.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
functionToStringIntegration,
1414
inboundFiltersIntegration,
1515
} from '@sentry/core';
16-
import type { Integration } from '@sentry/types';
16+
import type { Client, Integration } from '@sentry/types';
1717
import { logger } from '@sentry/utils';
1818

1919
import { IS_DEBUG_BUILD } from './flags';
@@ -44,7 +44,7 @@ export function getDefaultIntegrations(): Integration[] {
4444
/**
4545
* Inits the Angular SDK
4646
*/
47-
export function init(options: BrowserOptions): void {
47+
export function init(options: BrowserOptions): Client | undefined {
4848
const opts = {
4949
defaultIntegrations: getDefaultIntegrations(),
5050
...options,
@@ -53,7 +53,7 @@ export function init(options: BrowserOptions): void {
5353
applySdkMetadata(opts, 'angular');
5454

5555
checkAndSetAngularVersion();
56-
browserInit(opts);
56+
return browserInit(opts);
5757
}
5858

5959
function checkAndSetAngularVersion(): void {

packages/angular/test/sdk.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ describe('init', () => {
2626

2727
expect(angularDefaultIntegrations).toEqual(browserDefaultIntegrationsWithoutBrowserApiErrors);
2828
});
29+
30+
it('returns client from init', () => {
31+
expect(init({})).not.toBeUndefined();
32+
});
2933
});

packages/astro/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"@sentry/node": "8.11.0",
6767
"@sentry/types": "8.11.0",
6868
"@sentry/utils": "8.11.0",
69-
"@sentry/vite-plugin": "^2.18.0"
69+
"@sentry/vite-plugin": "^2.19.0"
7070
},
7171
"devDependencies": {
7272
"astro": "^3.5.0",

packages/astro/src/client/sdk.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
setTag,
77
} from '@sentry/browser';
88
import { applySdkMetadata, hasTracingEnabled } from '@sentry/core';
9-
import type { Integration } from '@sentry/types';
9+
import type { Client, Integration } from '@sentry/types';
1010

1111
// Tree-shakable guard to remove all code related to tracing
1212
declare const __SENTRY_TRACING__: boolean;
@@ -16,17 +16,19 @@ declare const __SENTRY_TRACING__: boolean;
1616
*
1717
* @param options Configuration options for the SDK.
1818
*/
19-
export function init(options: BrowserOptions): void {
19+
export function init(options: BrowserOptions): Client | undefined {
2020
const opts = {
2121
defaultIntegrations: getDefaultIntegrations(options),
2222
...options,
2323
};
2424

2525
applySdkMetadata(opts, 'astro', ['astro', 'browser']);
2626

27-
initBrowserSdk(opts);
27+
const client = initBrowserSdk(opts);
2828

2929
setTag('runtime', 'browser');
30+
31+
return client;
3032
}
3133

3234
function getDefaultIntegrations(options: BrowserOptions): Integration[] | undefined {

packages/astro/src/server/sdk.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
import { applySdkMetadata } from '@sentry/core';
2-
import type { NodeOptions } from '@sentry/node';
2+
import type { NodeClient, NodeOptions } from '@sentry/node';
33
import { init as initNodeSdk, setTag } from '@sentry/node';
44

55
/**
66
*
77
* @param options
88
*/
9-
export function init(options: NodeOptions): void {
9+
export function init(options: NodeOptions): NodeClient | undefined {
1010
const opts = {
1111
...options,
1212
};
1313

1414
applySdkMetadata(opts, 'astro', ['astro', 'node']);
1515

16-
initNodeSdk(opts);
16+
const client = initNodeSdk(opts);
1717

1818
setTag('runtime', 'node');
19+
20+
return client;
1921
}

packages/astro/test/client/sdk.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,9 @@ describe('Sentry client SDK', () => {
122122
expect(getActiveSpan()).toBeUndefined();
123123
});
124124
});
125+
126+
it('returns client from init', () => {
127+
expect(init({})).not.toBeUndefined();
128+
});
125129
});
126130
});

packages/astro/test/server/sdk.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,9 @@ describe('Sentry server SDK', () => {
4646

4747
expect(SentryNode.getIsolationScope().getScopeData().tags).toEqual({ runtime: 'node' });
4848
});
49+
50+
it('returns client from init', () => {
51+
expect(init({})).not.toBeUndefined();
52+
});
4953
});
5054
});

packages/aws-serverless/src/sdk.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { existsSync } from 'fs';
22
import { hostname } from 'os';
33
import { basename, resolve } from 'path';
44
import { types } from 'util';
5-
import type { NodeOptions } from '@sentry/node';
5+
import type { NodeClient, NodeOptions } from '@sentry/node';
66
import {
77
SDK_VERSION,
88
captureException,
@@ -74,7 +74,7 @@ export function getDefaultIntegrations(_options: Options): Integration[] {
7474
*
7575
* @param options Configuration options for the SDK, @see {@link AWSLambdaOptions}.
7676
*/
77-
export function init(options: NodeOptions = {}): void {
77+
export function init(options: NodeOptions = {}): NodeClient | undefined {
7878
const opts = {
7979
_metadata: {} as SdkMetadata,
8080
defaultIntegrations: getDefaultIntegrations(options),
@@ -93,7 +93,7 @@ export function init(options: NodeOptions = {}): void {
9393
version: SDK_VERSION,
9494
};
9595

96-
initWithoutDefaultIntegrations(opts);
96+
return initWithoutDefaultIntegrations(opts);
9797
}
9898

9999
/** */

packages/browser/src/sdk.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
lastEventId,
1010
startSession,
1111
} from '@sentry/core';
12-
import type { DsnLike, Integration, Options, UserFeedback } from '@sentry/types';
12+
import type { Client, DsnLike, Integration, Options, UserFeedback } from '@sentry/types';
1313
import { consoleSandbox, logger, stackParserFromStackParserOptions, supportsFetch } from '@sentry/utils';
1414

1515
import { addHistoryInstrumentationHandler } from '@sentry-internal/browser-utils';
@@ -139,7 +139,7 @@ declare const __SENTRY_RELEASE__: string | undefined;
139139
*
140140
* @see {@link BrowserOptions} for documentation on configuration options.
141141
*/
142-
export function init(browserOptions: BrowserOptions = {}): void {
142+
export function init(browserOptions: BrowserOptions = {}): Client | undefined {
143143
const options = applyDefaultOptions(browserOptions);
144144

145145
if (shouldShowBrowserExtensionError()) {
@@ -166,11 +166,13 @@ export function init(browserOptions: BrowserOptions = {}): void {
166166
transport: options.transport || makeFetchTransport,
167167
};
168168

169-
initAndBind(BrowserClient, clientOptions);
169+
const client = initAndBind(BrowserClient, clientOptions);
170170

171171
if (options.autoSessionTracking) {
172172
startSessionTracking();
173173
}
174+
175+
return client;
174176
}
175177

176178
/**

packages/browser/test/unit/sdk.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,5 +209,25 @@ describe('init', () => {
209209

210210
consoleErrorSpy.mockRestore();
211211
});
212+
213+
it("doesn't return a client on initialization error", () => {
214+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
215+
216+
Object.defineProperty(WINDOW, 'chrome', {
217+
value: { runtime: { id: 'mock-extension-id' } },
218+
writable: true,
219+
});
220+
221+
const client = init(options);
222+
223+
expect(client).toBeUndefined();
224+
225+
consoleErrorSpy.mockRestore();
226+
});
227+
});
228+
229+
it('returns a client from init', () => {
230+
const client = init();
231+
expect(client).not.toBeUndefined();
212232
});
213233
});

packages/bun/src/sdk.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
linkedErrorsIntegration,
55
requestDataIntegration,
66
} from '@sentry/core';
7+
import type { NodeClient } from '@sentry/node';
78
import {
89
consoleIntegration,
910
contextLinesIntegration,
@@ -91,13 +92,13 @@ export function getDefaultIntegrations(_options: Options): Integration[] {
9192
*
9293
* @see {@link BunOptions} for documentation on configuration options.
9394
*/
94-
export function init(options: BunOptions = {}): void {
95+
export function init(options: BunOptions = {}): NodeClient | undefined {
9596
options.clientClass = BunClient;
9697
options.transport = options.transport || makeFetchTransport;
9798

9899
if (options.defaultIntegrations === undefined) {
99100
options.defaultIntegrations = getDefaultIntegrations(options);
100101
}
101102

102-
initNode(options);
103+
return initNode(options);
103104
}

0 commit comments

Comments
 (0)