Skip to content

meta(changelog): Update changelog for 8.12.0 #12615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,38 @@

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

## 8.12.0

### Important Changes

- **feat(core): Return client from init method (#12585)**

`Sentry.init()` now returns a client directly, so you don't need to explicitly call `getClient()` anymore:

```js
const client = Sentry.init();
```

- **feat(nextjs): Add `deleteSourcemapsAfterUpload` option (#12457)**

This adds an easy way to delete sourcemaps immediately after uploading them:

```js
module.exports = withSentryConfig(nextConfig, {
sourcemaps: {
deleteSourcemapsAfterUpload: true,
},
});
```

### Other Changes

- feat(feedback): Extra check for iPad in screenshot support (#12593)
- fix(bundle): Ensure CDN bundles do not overwrite `window.Sentry` (#12580)
- ref(node): Add error message to NodeFetch log (#12612)

Work in this release was contributed by @n4bb12. Thank you for your contribution!

## 8.11.0

### Important Changes
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
window.sentryOnLoad = function () {
Sentry.init({});

window.__sentryLoaded = true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Sentry.forceLoad();

Sentry.captureException('Test exception');
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script>
window.Sentry = {_customThingOnSentry: 'customThingOnSentry' };
</script>
</head>
<body></body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { expect } from '@playwright/test';

import { sentryTest } from '../../../../utils/fixtures';
import { envelopeRequestParser, waitForErrorRequestOnUrl } from '../../../../utils/helpers';

sentryTest('keeps data on window.Sentry intact', async ({ getLocalTestUrl, page }) => {
await page.route('https://dsn.ingest.sentry.io/**/*', route => {
return route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({ id: 'test-id' }),
});
});

const url = await getLocalTestUrl({ testDir: __dirname });
const req = await waitForErrorRequestOnUrl(page, url);

const eventData = envelopeRequestParser(req);

expect(eventData.message).toBe('Test exception');

const customThingy = await page.evaluate('window.Sentry._customThingOnSentry');
expect(customThingy).toBe('customThingOnSentry');
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as fs from 'fs';
import * as path from 'path';
import * as assert from 'assert/strict';

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

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

export {};
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ const nextConfig = {
};

module.exports = withSentryConfig(nextConfig, {
silent: true,
debug: true,
sourcemaps: {
deleteSourcemapsAfterUpload: true,
},
});
6 changes: 6 additions & 0 deletions dev-packages/e2e-tests/verdaccio-config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ packages:
unpublish: $all
# proxy: npmjs # Don't proxy for E2E tests!

'@sentry/nuxt':
access: $all
publish: $all
unpublish: $all
# proxy: npmjs # Don't proxy for E2E tests!

'@sentry/wasm':
access: $all
publish: $all
Expand Down
3 changes: 3 additions & 0 deletions dev-packages/rollup-utils/bundleHelpers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ export function makeBaseBundleConfig(options) {
output: {
format: 'iife',
name: 'Sentry',
intro: () => {
return 'exports = window.Sentry || {};';
},
},
context: 'window',
plugins: [rrwebBuildPlugin, markAsBrowserBuildPlugin],
Expand Down
1 change: 1 addition & 0 deletions docs/commit-issue-pr-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ and committed as such onto `develop`.
- Make sure to rebase the branch on `develop` before squashing it
- Make sure to update the commit message of the squashed branch to follow the commit guidelines - including the PR
number
- If you are a Sentry employee, assign yourself to the PR

Please note that we cannot _enforce_ Squash Merge due to the usage of Gitflow (see below). Github remembers the last
used merge method, so you'll need to make sure to double check that you are using "Squash and Merge" correctly.
Expand Down
6 changes: 6 additions & 0 deletions docs/gitflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ We use [Gitflow](https://docs.github.com/en/get-started/quickstart/github-flow)
- Never merge directly into `master` (unless we want e.g. an emergency bugfix release)

![gitflow-chart](./assets/gitflow-chart.png)

## Important Caveats

While a release is pending, we may merge anything into develop, **except for changes to package.json files**. If we
change the package.json files on develop, the gitflow PR master -> develop will have merge conflicts, because during the
release the package.json files are updated on master.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"packages/integration-shims",
"packages/nextjs",
"packages/node",
"packages/nuxt",
"packages/opentelemetry",
"packages/profiling-node",
"packages/react",
Expand Down
6 changes: 3 additions & 3 deletions packages/angular/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
functionToStringIntegration,
inboundFiltersIntegration,
} from '@sentry/core';
import type { Integration } from '@sentry/types';
import type { Client, Integration } from '@sentry/types';
import { logger } from '@sentry/utils';

import { IS_DEBUG_BUILD } from './flags';
Expand Down Expand Up @@ -44,7 +44,7 @@ export function getDefaultIntegrations(): Integration[] {
/**
* Inits the Angular SDK
*/
export function init(options: BrowserOptions): void {
export function init(options: BrowserOptions): Client | undefined {
const opts = {
defaultIntegrations: getDefaultIntegrations(),
...options,
Expand All @@ -53,7 +53,7 @@ export function init(options: BrowserOptions): void {
applySdkMetadata(opts, 'angular');

checkAndSetAngularVersion();
browserInit(opts);
return browserInit(opts);
}

function checkAndSetAngularVersion(): void {
Expand Down
4 changes: 4 additions & 0 deletions packages/angular/test/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ describe('init', () => {

expect(angularDefaultIntegrations).toEqual(browserDefaultIntegrationsWithoutBrowserApiErrors);
});

it('returns client from init', () => {
expect(init({})).not.toBeUndefined();
});
});
2 changes: 1 addition & 1 deletion packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@sentry/node": "8.11.0",
"@sentry/types": "8.11.0",
"@sentry/utils": "8.11.0",
"@sentry/vite-plugin": "^2.18.0"
"@sentry/vite-plugin": "^2.19.0"
},
"devDependencies": {
"astro": "^3.5.0",
Expand Down
8 changes: 5 additions & 3 deletions packages/astro/src/client/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
setTag,
} from '@sentry/browser';
import { applySdkMetadata, hasTracingEnabled } from '@sentry/core';
import type { Integration } from '@sentry/types';
import type { Client, Integration } from '@sentry/types';

// Tree-shakable guard to remove all code related to tracing
declare const __SENTRY_TRACING__: boolean;
Expand All @@ -16,17 +16,19 @@ declare const __SENTRY_TRACING__: boolean;
*
* @param options Configuration options for the SDK.
*/
export function init(options: BrowserOptions): void {
export function init(options: BrowserOptions): Client | undefined {
const opts = {
defaultIntegrations: getDefaultIntegrations(options),
...options,
};

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

initBrowserSdk(opts);
const client = initBrowserSdk(opts);

setTag('runtime', 'browser');

return client;
}

function getDefaultIntegrations(options: BrowserOptions): Integration[] | undefined {
Expand Down
8 changes: 5 additions & 3 deletions packages/astro/src/server/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import { applySdkMetadata } from '@sentry/core';
import type { NodeOptions } from '@sentry/node';
import type { NodeClient, NodeOptions } from '@sentry/node';
import { init as initNodeSdk, setTag } from '@sentry/node';

/**
*
* @param options
*/
export function init(options: NodeOptions): void {
export function init(options: NodeOptions): NodeClient | undefined {
const opts = {
...options,
};

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

initNodeSdk(opts);
const client = initNodeSdk(opts);

setTag('runtime', 'node');

return client;
}
4 changes: 4 additions & 0 deletions packages/astro/test/client/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,9 @@ describe('Sentry client SDK', () => {
expect(getActiveSpan()).toBeUndefined();
});
});

it('returns client from init', () => {
expect(init({})).not.toBeUndefined();
});
});
});
4 changes: 4 additions & 0 deletions packages/astro/test/server/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,9 @@ describe('Sentry server SDK', () => {

expect(SentryNode.getIsolationScope().getScopeData().tags).toEqual({ runtime: 'node' });
});

it('returns client from init', () => {
expect(init({})).not.toBeUndefined();
});
});
});
6 changes: 3 additions & 3 deletions packages/aws-serverless/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { existsSync } from 'fs';
import { hostname } from 'os';
import { basename, resolve } from 'path';
import { types } from 'util';
import type { NodeOptions } from '@sentry/node';
import type { NodeClient, NodeOptions } from '@sentry/node';
import {
SDK_VERSION,
captureException,
Expand Down Expand Up @@ -74,7 +74,7 @@ export function getDefaultIntegrations(_options: Options): Integration[] {
*
* @param options Configuration options for the SDK, @see {@link AWSLambdaOptions}.
*/
export function init(options: NodeOptions = {}): void {
export function init(options: NodeOptions = {}): NodeClient | undefined {
const opts = {
_metadata: {} as SdkMetadata,
defaultIntegrations: getDefaultIntegrations(options),
Expand All @@ -93,7 +93,7 @@ export function init(options: NodeOptions = {}): void {
version: SDK_VERSION,
};

initWithoutDefaultIntegrations(opts);
return initWithoutDefaultIntegrations(opts);
}

/** */
Expand Down
8 changes: 5 additions & 3 deletions packages/browser/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
lastEventId,
startSession,
} from '@sentry/core';
import type { DsnLike, Integration, Options, UserFeedback } from '@sentry/types';
import type { Client, DsnLike, Integration, Options, UserFeedback } from '@sentry/types';
import { consoleSandbox, logger, stackParserFromStackParserOptions, supportsFetch } from '@sentry/utils';

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

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

initAndBind(BrowserClient, clientOptions);
const client = initAndBind(BrowserClient, clientOptions);

if (options.autoSessionTracking) {
startSessionTracking();
}

return client;
}

/**
Expand Down
20 changes: 20 additions & 0 deletions packages/browser/test/unit/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,5 +209,25 @@ describe('init', () => {

consoleErrorSpy.mockRestore();
});

it("doesn't return a client on initialization error", () => {
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});

Object.defineProperty(WINDOW, 'chrome', {
value: { runtime: { id: 'mock-extension-id' } },
writable: true,
});

const client = init(options);

expect(client).toBeUndefined();

consoleErrorSpy.mockRestore();
});
});

it('returns a client from init', () => {
const client = init();
expect(client).not.toBeUndefined();
});
});
5 changes: 3 additions & 2 deletions packages/bun/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
linkedErrorsIntegration,
requestDataIntegration,
} from '@sentry/core';
import type { NodeClient } from '@sentry/node';
import {
consoleIntegration,
contextLinesIntegration,
Expand Down Expand Up @@ -91,13 +92,13 @@ export function getDefaultIntegrations(_options: Options): Integration[] {
*
* @see {@link BunOptions} for documentation on configuration options.
*/
export function init(options: BunOptions = {}): void {
export function init(options: BunOptions = {}): NodeClient | undefined {
options.clientClass = BunClient;
options.transport = options.transport || makeFetchTransport;

if (options.defaultIntegrations === undefined) {
options.defaultIntegrations = getDefaultIntegrations(options);
}

initNode(options);
return initNode(options);
}
Loading
Loading