Skip to content

Commit 4adbc0b

Browse files
committed
Merge branch 'master' of github.com:getsentry/sentry-javascript
2 parents 513fb9e + 58b2ba1 commit 4adbc0b

File tree

4 files changed

+35
-21
lines changed

4 files changed

+35
-21
lines changed

.craft.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,5 @@ targets:
6666
versions:
6767
- nodejs10.x
6868
- nodejs12.x
69+
- nodejs14.x
6970
license: MIT

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<br />
66
</p>
77

8+
_Bad software is everywhere, and we're tired of it. Sentry is on a mission to help developers write better software faster, so we can get back to enjoying technology. If you want to join us [<kbd>**Check out our open positions**</kbd>](https://sentry.io/careers/)_
9+
810
![Build & Test](https://github.com/getsentry/sentry-javascript/workflows/Build%20&%20Test/badge.svg)
911
[![codecov](https://codecov.io/gh/getsentry/sentry-javascript/branch/master/graph/badge.svg)](https://codecov.io/gh/getsentry/sentry-javascript)
1012
[![npm version](https://img.shields.io/npm/v/@sentry/core.svg)](https://www.npmjs.com/package/@sentry/core)

packages/browser/src/sdk.ts

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,23 @@ function startSessionTracking(): void {
189189

190190
const hub = getCurrentHub();
191191

192-
hub.startSession();
193-
hub.captureSession();
194-
195-
// We want to create a session for every navigation as well
196-
addInstrumentationHandler({
197-
callback: () => {
198-
hub.startSession();
199-
hub.captureSession();
200-
},
201-
type: 'history',
202-
});
192+
if ('startSession' in hub) {
193+
// The only way for this to be false is for there to be a version mismatch between @sentry/browser (>= 6.0.0) and
194+
// @sentry/hub (< 5.27.0). In the simple case, there won't ever be such a mismatch, because the two packages are
195+
// pinned at the same version in package.json, but there are edge cases where it's possible'. See
196+
// https://github.com/getsentry/sentry-javascript/issues/3234 and
197+
// https://github.com/getsentry/sentry-javascript/issues/3207.
198+
199+
hub.startSession();
200+
hub.captureSession();
201+
202+
// We want to create a session for every navigation as well
203+
addInstrumentationHandler({
204+
callback: () => {
205+
hub.startSession();
206+
hub.captureSession();
207+
},
208+
type: 'history',
209+
});
210+
}
203211
}

packages/react/src/sdk.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@ import { BrowserOptions, init as browserInit, SDK_VERSION } from '@sentry/browse
55
*/
66
export function init(options: BrowserOptions): void {
77
options._metadata = options._metadata || {};
8-
options._metadata.sdk = {
9-
name: 'sentry.javascript.react',
10-
packages: [
11-
{
12-
name: 'npm:@sentry/react',
13-
version: SDK_VERSION,
14-
},
15-
],
16-
version: SDK_VERSION,
17-
};
8+
if (options._metadata.sdk === undefined) {
9+
options._metadata.sdk = {
10+
name: 'sentry.javascript.react',
11+
packages: [
12+
{
13+
name: 'npm:@sentry/react',
14+
version: SDK_VERSION,
15+
},
16+
],
17+
version: SDK_VERSION,
18+
};
19+
}
20+
1821
browserInit(options);
1922
}

0 commit comments

Comments
 (0)