Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: getsentry/sentry-javascript
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6.13.2
Choose a base ref
...
head repository: getsentry/sentry-javascript
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6.13.3
Choose a head ref
  • 12 commits
  • 41 files changed
  • 8 contributors

Commits on Sep 21, 2021

  1. Merge branch 'release/6.13.2'

    getsentry-bot committed Sep 21, 2021
    Copy the full SHA
    873f167 View commit details

Commits on Sep 22, 2021

  1. feat(nextjs): Support distDir Next.js option (#3990)

    Add support for [setting custom build directories](https://nextjs.org/docs/api-reference/next.config.js/setting-a-custom-build-directory). Although this allows to custom that directory, source maps won't work; supporting them will come in a follow-up PR.
    iker-barriocanal authored Sep 22, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    27f8609 View commit details

Commits on Sep 23, 2021

  1. chore(react): Add ts-ignore for fallback tests (#4004)

    Some tests are testing behaviour when we pass the wrong type
    on purpose. We should make sure we ts-ignore in those cases.
    AbhiPrasad authored Sep 23, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d920532 View commit details

Commits on Sep 27, 2021

  1. ref(browser): Refactor sending client reports w. fetch fallback (#4008)

    * ref(browser): Refactor sending client reports w. fetch fallback
    kamilogorek authored Sep 27, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0e664af View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f96d47b View commit details

Commits on Oct 1, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    feb2bb5 View commit details
  2. feat(nextjs): Add ability for integration tests to use linked `@sentr…

    …y/xxxx` packages (#4019)
    
    In the nextjs integration tests, we use file dependencies for all of the packages in the `sentry-javascript` repo, so that the tests test the local (rather than published) version of the SDK. We don't do the same for `@sentry/cli` or `@sentry/webpack-plugin`, though, because they're in a separate repo and we can't predict where the local copy of that repo lives. As a result, we currently can't (in the nextjs integration tests, at least) test any local changes in either package.
    
    This solves that problem by optionally linking to the local copies of those repos as part of the integration test runner script. In order to use this optional linking:
    
    - To link `@sentry/cli`, set `LINKED_CLI_REPO=<abs path of local sentry-cli repo>`.
    - To link `@sentry/webpack-plugin`, set the CLI variable above (since `@sentry/cli` is a dependency of `@sentry/webpack-plugin`, we need to link it in the plugin repo also) as well as `LINKED_PLUGIN_REPO=<abs path of local sentry-webpack-plugin repo>`
    lobsterkatie authored Oct 1, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    389ae60 View commit details

Commits on Oct 4, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d1c471f View commit details
  2. ref(ember): Update htmlbars dependency (#4026)

    As noted in #4015, a registerPlugin deprecation is now caused by @sentry/ember because of the Ember version upgrade. As mentioned here, https://github.com/emberjs/ember.js/pull/19429\#issuecomment-786403885 updating htmlbars should fix this.
    k-fish authored Oct 4, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    bdcf133 View commit details

Commits on Oct 6, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    00fba50 View commit details
  2. misc: 6.13.3 changelog

    kamilogorek committed Oct 6, 2021
    Copy the full SHA
    24ab018 View commit details
  3. release: 6.13.3

    getsentry-bot committed Oct 6, 2021
    Copy the full SHA
    cbb01ba View commit details
Showing with 665 additions and 339 deletions.
  1. +11 −0 CHANGELOG.md
  2. +1 −1 lerna.json
  3. +5 −5 packages/angular/package.json
  4. +5 −5 packages/browser/package.json
  5. +7 −6 packages/browser/src/transports/base.ts
  6. +2 −78 packages/browser/src/transports/fetch.ts
  7. +106 −0 packages/browser/src/transports/utils.ts
  8. +6 −6 packages/core/package.json
  9. +1 −1 packages/core/src/version.ts
  10. +7 −7 packages/ember/package.json
  11. +3 −3 packages/eslint-config-sdk/package.json
  12. +1 −1 packages/eslint-plugin-sdk/package.json
  13. +4 −4 packages/gatsby/package.json
  14. +4 −4 packages/hub/package.json
  15. +4 −4 packages/integrations/package.json
  16. +4 −8 packages/integrations/src/extraerrordata.ts
  17. +4 −4 packages/minimal/package.json
  18. +8 −8 packages/nextjs/package.json
  19. +11 −2 packages/nextjs/src/config/index.ts
  20. +125 −0 packages/nextjs/src/config/nextConfigToWebpackPluginConfig.ts
  21. +6 −5 packages/nextjs/src/config/webpack.ts
  22. +49 −3 packages/nextjs/test/config.test.ts
  23. +117 −0 packages/nextjs/test/config/nextConfigToWebpackPluginConfig.test.ts
  24. +51 −0 packages/nextjs/test/integration_test_utils.sh
  25. +7 −1 packages/nextjs/test/run-integration-tests.sh
  26. +7 −7 packages/node/package.json
  27. +6 −6 packages/react/package.json
  28. +16 −50 packages/react/src/errorboundary.tsx
  29. +23 −47 packages/react/test/errorboundary.test.tsx
  30. +7 −7 packages/serverless/package.json
  31. +7 −7 packages/tracing/package.json
  32. +1 −1 packages/tracing/src/hubextensions.ts
  33. +1 −1 packages/tracing/src/transaction.ts
  34. +19 −0 packages/tracing/test/hub.test.ts
  35. +2 −2 packages/types/package.json
  36. +1 −1 packages/types/src/client.ts
  37. +1 −1 packages/typescript/package.json
  38. +3 −3 packages/utils/package.json
  39. +7 −7 packages/vue/package.json
  40. +4 −4 packages/wasm/package.json
  41. +11 −39 yarn.lock
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -4,6 +4,17 @@

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

## 6.13.3

- feat(nextjs): Add ability for integration tests to use linked `@sentry/xxxx` packages (#4019)
- feat(nextjs): Support `distDir` Next.js option (#3990)
- fix(tracing): Call hasTracingEnabled with correct options when invoking startTransaction (#4020)
- ref(browser): Refactor sending client reports w. fetch fallback (#4008)
- ref(core): Make getTransport method on client optional (#4013)
- ref(ember): Update htmlbars dependency (#4026)
- ref(integrations): Minor simplification of ExtraErrorData code (#4024)
- ref(react): Rely on error.cause to link ErrorBoundary errors (#4005)

## 6.13.2

- fix(browser): Use getGlobalObject for document check (#3996)
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lerna": "3.4.0",
"version": "6.13.2",
"version": "6.13.3",
"packages": "packages/*",
"npmClient": "yarn",
"useWorkspaces": true
10 changes: 5 additions & 5 deletions packages/angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry/angular",
"version": "6.13.2",
"version": "6.13.3",
"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",
@@ -21,17 +21,17 @@
"@angular/router": "10.x || 11.x || 12.x"
},
"dependencies": {
"@sentry/browser": "6.13.2",
"@sentry/types": "6.13.2",
"@sentry/utils": "6.13.2",
"@sentry/browser": "6.13.3",
"@sentry/types": "6.13.3",
"@sentry/utils": "6.13.3",
"rxjs": "^6.6.0",
"tslib": "^1.9.3"
},
"devDependencies": {
"@angular/common": "^10.0.3",
"@angular/core": "^10.0.3",
"@angular/router": "^10.0.3",
"@sentry-internal/eslint-config-sdk": "6.13.2",
"@sentry-internal/eslint-config-sdk": "6.13.3",
"npm-run-all": "^4.1.2",
"prettier": "1.19.0",
"rimraf": "^2.6.3",
10 changes: 5 additions & 5 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry/browser",
"version": "6.13.2",
"version": "6.13.3",
"description": "Official Sentry SDK for browsers",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/browser",
@@ -16,13 +16,13 @@
"access": "public"
},
"dependencies": {
"@sentry/core": "6.13.2",
"@sentry/types": "6.13.2",
"@sentry/utils": "6.13.2",
"@sentry/core": "6.13.3",
"@sentry/types": "6.13.3",
"@sentry/utils": "6.13.3",
"tslib": "^1.9.3"
},
"devDependencies": {
"@sentry-internal/eslint-config-sdk": "6.13.2",
"@sentry-internal/eslint-config-sdk": "6.13.3",
"@types/eslint": "^7.2.0",
"@types/md5": "2.1.33",
"btoa": "^1.2.1",
13 changes: 7 additions & 6 deletions packages/browser/src/transports/base.ts
Original file line number Diff line number Diff line change
@@ -17,6 +17,8 @@ import {
SentryError,
} from '@sentry/utils';

import { sendReport } from './utils';

const CATEGORY_MAPPING: {
[key in SentryRequestType]: string;
} = {
@@ -99,11 +101,6 @@ export abstract class BaseTransport implements Transport {
return;
}

if (!global.navigator || typeof global.navigator.sendBeacon !== 'function') {
logger.warn('Beacon API not available, skipping sending outcomes.');
return;
}

const outcomes = this._outcomes;
this._outcomes = {};

@@ -134,7 +131,11 @@ export abstract class BaseTransport implements Transport {
});
const envelope = `${envelopeHeader}\n${itemHeaders}\n${item}`;

global.navigator.sendBeacon(url, envelope);
try {
sendReport(url, envelope);
} catch (e) {
logger.error(e);
}
}

/**
80 changes: 2 additions & 78 deletions packages/browser/src/transports/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,85 +1,9 @@
import { eventToSentryRequest, sessionToSentryRequest } from '@sentry/core';
import { Event, Outcome, Response, SentryRequest, Session, TransportOptions } from '@sentry/types';
import {
getGlobalObject,
isNativeFetch,
logger,
SentryError,
supportsReferrerPolicy,
SyncPromise,
} from '@sentry/utils';
import { SentryError, supportsReferrerPolicy, SyncPromise } from '@sentry/utils';

import { BaseTransport } from './base';

type FetchImpl = typeof fetch;

/**
* A special usecase for incorrectly wrapped Fetch APIs in conjunction with ad-blockers.
* Whenever someone wraps the Fetch API and returns the wrong promise chain,
* this chain becomes orphaned and there is no possible way to capture it's rejections
* other than allowing it bubble up to this very handler. eg.
*
* const f = window.fetch;
* window.fetch = function () {
* const p = f.apply(this, arguments);
*
* p.then(function() {
* console.log('hi.');
* });
*
* return p;
* }
*
* `p.then(function () { ... })` is producing a completely separate promise chain,
* however, what's returned is `p` - the result of original `fetch` call.
*
* This mean, that whenever we use the Fetch API to send our own requests, _and_
* some ad-blocker blocks it, this orphaned chain will _always_ reject,
* effectively causing another event to be captured.
* This makes a whole process become an infinite loop, which we need to somehow
* deal with, and break it in one way or another.
*
* To deal with this issue, we are making sure that we _always_ use the real
* browser Fetch API, instead of relying on what `window.fetch` exposes.
* The only downside to this would be missing our own requests as breadcrumbs,
* but because we are already not doing this, it should be just fine.
*
* Possible failed fetch error messages per-browser:
*
* Chrome: Failed to fetch
* Edge: Failed to Fetch
* Firefox: NetworkError when attempting to fetch resource
* Safari: resource blocked by content blocker
*/
function getNativeFetchImplementation(): FetchImpl {
/* eslint-disable @typescript-eslint/unbound-method */

// Fast path to avoid DOM I/O
const global = getGlobalObject<Window>();
if (isNativeFetch(global.fetch)) {
return global.fetch.bind(global);
}

const document = global.document;
let fetchImpl = global.fetch;
// eslint-disable-next-line deprecation/deprecation
if (typeof document?.createElement === `function`) {
try {
const sandbox = document.createElement('iframe');
sandbox.hidden = true;
document.head.appendChild(sandbox);
if (sandbox.contentWindow?.fetch) {
fetchImpl = sandbox.contentWindow.fetch;
}
document.head.removeChild(sandbox);
} catch (e) {
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', e);
}
}

return fetchImpl.bind(global);
/* eslint-enable @typescript-eslint/unbound-method */
}
import { FetchImpl, getNativeFetchImplementation } from './utils';

/** `fetch` based transport */
export class FetchTransport extends BaseTransport {
106 changes: 106 additions & 0 deletions packages/browser/src/transports/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import { forget, getGlobalObject, isNativeFetch, logger, supportsFetch } from '@sentry/utils';

const global = getGlobalObject<Window>();
let cachedFetchImpl: FetchImpl;

export type FetchImpl = typeof fetch;

/**
* A special usecase for incorrectly wrapped Fetch APIs in conjunction with ad-blockers.
* Whenever someone wraps the Fetch API and returns the wrong promise chain,
* this chain becomes orphaned and there is no possible way to capture it's rejections
* other than allowing it bubble up to this very handler. eg.
*
* const f = window.fetch;
* window.fetch = function () {
* const p = f.apply(this, arguments);
*
* p.then(function() {
* console.log('hi.');
* });
*
* return p;
* }
*
* `p.then(function () { ... })` is producing a completely separate promise chain,
* however, what's returned is `p` - the result of original `fetch` call.
*
* This mean, that whenever we use the Fetch API to send our own requests, _and_
* some ad-blocker blocks it, this orphaned chain will _always_ reject,
* effectively causing another event to be captured.
* This makes a whole process become an infinite loop, which we need to somehow
* deal with, and break it in one way or another.
*
* To deal with this issue, we are making sure that we _always_ use the real
* browser Fetch API, instead of relying on what `window.fetch` exposes.
* The only downside to this would be missing our own requests as breadcrumbs,
* but because we are already not doing this, it should be just fine.
*
* Possible failed fetch error messages per-browser:
*
* Chrome: Failed to fetch
* Edge: Failed to Fetch
* Firefox: NetworkError when attempting to fetch resource
* Safari: resource blocked by content blocker
*/
export function getNativeFetchImplementation(): FetchImpl {
if (cachedFetchImpl) {
return cachedFetchImpl;
}

/* eslint-disable @typescript-eslint/unbound-method */

// Fast path to avoid DOM I/O
if (isNativeFetch(global.fetch)) {
return (cachedFetchImpl = global.fetch.bind(global));
}

const document = global.document;
let fetchImpl = global.fetch;
// eslint-disable-next-line deprecation/deprecation
if (typeof document?.createElement === `function`) {
try {
const sandbox = document.createElement('iframe');
sandbox.hidden = true;
document.head.appendChild(sandbox);
if (sandbox.contentWindow?.fetch) {
fetchImpl = sandbox.contentWindow.fetch;
}
document.head.removeChild(sandbox);
} catch (e) {
logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', e);
}
}

return (cachedFetchImpl = fetchImpl.bind(global));
/* eslint-enable @typescript-eslint/unbound-method */
}

/**
* Sends sdk client report using sendBeacon or fetch as a fallback if available
*
* @param url report endpoint
* @param body report payload
*/
export function sendReport(url: string, body: string): void {
const isRealNavigator = Object.prototype.toString.call(global && global.navigator) === '[object Navigator]';
const hasSendBeacon = isRealNavigator && typeof global.navigator.sendBeacon === 'function';

if (hasSendBeacon) {
// Prevent illegal invocations - https://xgwang.me/posts/you-may-not-know-beacon/#it-may-throw-error%2C-be-sure-to-catch
const sendBeacon = global.navigator.sendBeacon.bind(global.navigator);
return sendBeacon(url, body);
}

if (supportsFetch()) {
const fetch = getNativeFetchImplementation();
return forget(
fetch(url, {
body,
method: 'POST',
credentials: 'omit',
keepalive: true,
}),
);
}
}
12 changes: 6 additions & 6 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry/core",
"version": "6.13.2",
"version": "6.13.3",
"description": "Base implementation for all Sentry JavaScript SDKs",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/core",
@@ -16,14 +16,14 @@
"access": "public"
},
"dependencies": {
"@sentry/hub": "6.13.2",
"@sentry/minimal": "6.13.2",
"@sentry/types": "6.13.2",
"@sentry/utils": "6.13.2",
"@sentry/hub": "6.13.3",
"@sentry/minimal": "6.13.3",
"@sentry/types": "6.13.3",
"@sentry/utils": "6.13.3",
"tslib": "^1.9.3"
},
"devDependencies": {
"@sentry-internal/eslint-config-sdk": "6.13.2",
"@sentry-internal/eslint-config-sdk": "6.13.3",
"jest": "^24.7.1",
"npm-run-all": "^4.1.2",
"prettier": "1.19.0",
2 changes: 1 addition & 1 deletion packages/core/src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const SDK_VERSION = '6.13.2';
export const SDK_VERSION = '6.13.3';
14 changes: 7 additions & 7 deletions packages/ember/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry/ember",
"version": "6.13.2",
"version": "6.13.3",
"description": "Official Sentry SDK for Ember.js",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/ember",
@@ -32,21 +32,21 @@
},
"dependencies": {
"@embroider/macros": "~0.37.0",
"@sentry/browser": "6.13.2",
"@sentry/tracing": "6.13.2",
"@sentry/types": "6.13.2",
"@sentry/utils": "6.13.2",
"@sentry/browser": "6.13.3",
"@sentry/tracing": "6.13.3",
"@sentry/types": "6.13.3",
"@sentry/utils": "6.13.3",
"ember-auto-import": "~1.6.0",
"ember-cli-babel": "~7.26.6",
"ember-cli-htmlbars": "~5.1.2",
"ember-cli-htmlbars": "^5.7.1",
"ember-cli-typescript": "~3.1.4"
},
"devDependencies": {
"@ember/optional-features": "~1.3.0",
"@embroider/test-setup": "~0.37.0",
"@glimmer/component": "~1.0.0",
"@glimmer/tracking": "~1.0.0",
"@sentry-internal/eslint-config-sdk": "6.13.2",
"@sentry-internal/eslint-config-sdk": "6.13.3",
"@types/ember": "~3.16.5",
"@types/ember-qunit": "~3.4.9",
"@types/ember__test-helpers": "~1.7.0",
6 changes: 3 additions & 3 deletions packages/eslint-config-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry-internal/eslint-config-sdk",
"version": "6.13.2",
"version": "6.13.3",
"description": "Official Sentry SDK eslint config",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/eslint-config-sdk",
@@ -19,8 +19,8 @@
"access": "public"
},
"dependencies": {
"@sentry-internal/eslint-plugin-sdk": "6.13.2",
"@sentry-internal/typescript": "6.13.2",
"@sentry-internal/eslint-plugin-sdk": "6.13.3",
"@sentry-internal/typescript": "6.13.3",
"@typescript-eslint/eslint-plugin": "^3.9.0",
"@typescript-eslint/parser": "^3.9.0",
"eslint-config-prettier": "^6.11.0",
Loading