Skip to content
This repository has been archived by the owner on May 18, 2022. It is now read-only.

[NEU-164] Remove @sentry/electron integration #846

Merged
merged 1 commit into from
Mar 25, 2022
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
19 changes: 0 additions & 19 deletions main-src/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ const {
} = require('electron');
const path = require('path');
const fs = require('fs-extra');
const isDev = require('electron-is-dev');
const settings = require('electron-settings');
const electronRemote = require('@electron/remote/main');
const rtlDetect = require('rtl-detect');
const Sentry = require('@sentry/electron/main');

const appJson = require('./constants/app-json');
const isMas = require('./libs/is-mas');
Expand Down Expand Up @@ -72,21 +70,6 @@ const {
setPreference,
} = require('./libs/preferences');

// Activate the Sentry Electron SDK as early as possible in every process.
const sentryEnabled = !isDev && getPreference('sentry');
if (sentryEnabled) {
// https://github.com/getsentry/sentry-electron/blob/06c9874584f7734fe6cb8297c6455cf6356d29d4/MIGRATION.md
Sentry.init({
dsn: process.env.ELECTRON_APP_SENTRY_DSN,
release: app.getVersion(),
autoSessionTracking: false,
// disable native crash reporting
// as it mostly reports Electron's bugs (upstream bugs)
integrations: (defaultIntegrations) => defaultIntegrations
.filter((i) => i.name !== Sentry.Integrations.SentryMinidump.Id),
});
}

const loadListeners = require('./listeners');
const loadInvokers = require('./invokers');

Expand Down Expand Up @@ -619,8 +602,6 @@ if (!gotTheLock) {
global.hibernateWhenUnused = hibernateWhenUnused;
global.hibernateWhenUnusedTimeout = hibernateWhenUnusedTimeout;

global.sentryEnabled = sentryEnabled;

// on Windows, if the display language is RTL language (Arabic, Hebrew, etc)
// the x bounds coordination is reversed
// so we have this to handle BrowserViews and related UI correctly
Expand Down
3 changes: 0 additions & 3 deletions main-src/libs/keytar.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
const { captureException } = require('@sentry/electron');

let keytar;

// on Linux
Expand All @@ -14,7 +12,6 @@ try {
} catch (err) {
// eslint-disable-next-line no-console
console.log(err);
captureException(err);
}

module.exports = keytar;
5 changes: 2 additions & 3 deletions main-src/libs/system-preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
const { app } = require('electron');
const AutoLaunch = require('auto-launch');
const settings = require('electron-settings');
const { captureException } = require('@sentry/electron');

const sendToAllWindows = require('./send-to-all-windows');

Expand All @@ -30,7 +29,8 @@ const checkAutoLauncherStatusAsync = () => {
sendToAllWindows('set-system-preference', 'openAtLogin', 'no');
})
.catch((err) => {
captureException(err);
// eslint-disable-next-line no-console
console.log(err);
sendToAllWindows('set-system-preference', 'openAtLogin', 'no');
});
}
Expand Down Expand Up @@ -98,7 +98,6 @@ const setSystemPreference = (name, value) => {
}
return null;
})
.catch((err) => captureException(err))
.then(() => {
checkAutoLauncherStatusAsync();
});
Expand Down
4 changes: 2 additions & 2 deletions main-src/libs/window-shortcut.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
const {
globalShortcut,
} = require('electron');
const { captureException } = require('@sentry/electron');
const mainWindow = require('../windows/main');

const unset = (combinator) => {
Expand Down Expand Up @@ -33,7 +32,8 @@ const set = (combinator) => {
}
});
} catch (err) {
captureException(err);
// eslint-disable-next-line no-console
console.log(err);
}
};

Expand Down
4 changes: 0 additions & 4 deletions main-src/libs/workspaces-views.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ const {
const path = require('path');
const fs = require('fs-extra');

const { captureException } = require('@sentry/electron');

const {
countWorkspaces,
createWorkspace,
Expand Down Expand Up @@ -278,7 +276,6 @@ const createWorkspaceView = (workspaceObj = {}) => {
.catch((err) => {
// eslint-disable-next-line no-console
console.log(err);
captureException(err);
});
}
});
Expand All @@ -297,7 +294,6 @@ const initWorkspaceViews = () => {
.catch((err) => {
// eslint-disable-next-line no-console
console.log(err);
captureException(err);
});
});
}
Expand Down
29 changes: 14 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,26 @@
"node-mac-permissions": "2.2.0"
},
"devDependencies": {
"@aws-sdk/client-s3": "3.55.0",
"@aws-sdk/client-s3": "3.56.0",
"@babel/core": "7.17.8",
"@babel/eslint-parser": "7.17.0",
"@babel/preset-env": "7.16.11",
"@babel/preset-react": "7.16.7",
"@cliqz/adblocker-electron": "1.23.6",
"@cliqz/adblocker-electron": "1.23.7",
"@elastic/app-search-javascript": "8.1.0",
"@elastic/react-search-ui": "1.10.0",
"@elastic/react-search-ui-views": "1.10.0",
"@elastic/search-ui-app-search-connector": "1.10.0",
"@elastic/react-search-ui": "1.10.1",
"@elastic/react-search-ui-views": "1.10.1",
"@elastic/search-ui-app-search-connector": "1.10.1",
"@electron/get": "1.14.1",
"@electron/remote": "2.0.8",
"@emotion/react": "11.8.2",
"@emotion/styled": "11.8.1",
"@fontsource/roboto": "4.5.3",
"@fontsource/roboto": "4.5.5",
"@mui/icons-material": "5.5.1",
"@mui/lab": "5.0.0-alpha.74",
"@mui/material": "5.5.2",
"@mui/styles": "5.5.1",
"@sentry/electron": "3.0.4",
"@types/react": "17.0.41",
"@types/react": "17.0.43",
"@types/react-dom": "17.0.14",
"ace-builds": "1.4.14",
"amplitude-js": "8.17.0",
Expand All @@ -66,27 +65,27 @@
"cheerio": "1.0.0-rc.10",
"classnames": "2.3.1",
"clean-deep": "3.4.0",
"clean-webpack-plugin": "3.0.0",
"clean-webpack-plugin": "4.0.0",
"color": "3.2.1",
"concurrently": "7.0.0",
"copy-webpack-plugin": "6.4.1",
"copy-webpack-plugin": "10.2.4",
"cross-env": "7.0.3",
"crypto-js": "4.1.1",
"darkreader": "4.9.46",
"date-fns": "2.28.0",
"del": "6.0.0",
"electron": "18.0.0-beta.5",
"electron": "18.0.0-beta.6",
"electron-builder": "22.14.13",
"electron-chrome-extensions": "3.9.0",
"electron-context-menu": "3.1.2",
"electron-fetch": "1.7.4",
"electron-fetch": "1.8.0",
"electron-is-dev": "2.0.0",
"electron-notarize": "1.1.1",
"electron-notarize": "1.2.1",
"electron-positioner": "4.1.0",
"electron-settings": "4.0.2",
"electron-updater": "4.6.5",
"electron-window-state": "5.0.3",
"eslint": "7.32.0",
"eslint": "8.11.0",
"eslint-config-airbnb": "19.0.4",
"eslint-plugin-header": "3.1.1",
"eslint-plugin-import": "2.25.4",
Expand Down Expand Up @@ -126,7 +125,7 @@
"tmp": "0.2.1",
"unused-filename": "3.0.1",
"uuid": "8.3.2",
"wait-on": "5.3.0",
"wait-on": "6.0.1",
"webpack": "5.70.0",
"webpack-cli": "4.9.2"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/node_modules/@cliqz/adblocker-electron/dist/cjs/adblocker.js b/node_modules/@cliqz/adblocker-electron/dist/cjs/adblocker.js
index b8fb45d..cce335c 100644
index d4ce056..4dc77ee 100644
--- a/node_modules/@cliqz/adblocker-electron/dist/cjs/adblocker.js
+++ b/node_modules/@cliqz/adblocker-electron/dist/cjs/adblocker.js
@@ -21,7 +21,10 @@ exports.ElectronBlocker = exports.BlockingContext = exports.fromElectronDetails
@@ -25,7 +25,10 @@ exports.ElectronBlocker = exports.BlockingContext = exports.fromElectronDetails
const electron_1 = require("electron");
const tldts_experimental_1 = require("tldts-experimental");
const adblocker_1 = require("@cliqz/adblocker");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/node_modules/electron-fetch/lib/index.es.js b/node_modules/electron-fetch/lib/index.es.js
index 3474009..effd43f 100644
index 94d2264..6630bed 100644
--- a/node_modules/electron-fetch/lib/index.es.js
+++ b/node_modules/electron-fetch/lib/index.es.js
@@ -285,6 +285,21 @@ Body.prototype = {
Expand All @@ -25,10 +25,10 @@ index 3474009..effd43f 100644
* Decode response as text, while automatically detecting the encoding and
* trying to decode to UTF-8 (non-spec api)
diff --git a/node_modules/electron-fetch/lib/index.js b/node_modules/electron-fetch/lib/index.js
index c9ea590..03b8558 100644
index 6e3fb52..17bccf0 100644
--- a/node_modules/electron-fetch/lib/index.js
+++ b/node_modules/electron-fetch/lib/index.js
@@ -315,6 +315,21 @@ Body.prototype = {
@@ -313,6 +313,21 @@ Body.prototype = {
return consumeBody.call(this);
},

Expand Down
4 changes: 2 additions & 2 deletions src/amplitude.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import amplitude from 'amplitude-js';
import { v5 as uuidv5 } from 'uuid';
import { app } from '@electron/remote';
import { captureException } from '@sentry/electron/renderer';

import { getMachineIdAsync } from './invokers';

Expand All @@ -23,7 +22,8 @@ getMachineIdAsync()
amplitude.getInstance().setDeviceId(deviceId);
})
.catch((err) => {
captureException(err);
// eslint-disable-next-line no-console
console.log(err);
});

export default amplitude;
11 changes: 0 additions & 11 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,6 @@ import getWorkspaceFriendlyName from './helpers/get-workspace-friendly-name';

import { getReactInitialStateAsync } from './invokers';

if (getStaticGlobal('sentryEnabled')) {
import('@sentry/electron/renderer')
.then((Sentry) => {
Sentry.init({});
})
.catch((err) => {
// eslint-disable-next-line no-console
console.log(err);
});
}

const appJson = getStaticGlobal('appJson');

const AddWorkspace = React.lazy(() => import('./components/add-workspace'));
Expand Down
4 changes: 0 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ const getElectronMainConfig = () => {
},
devtool: 'source-map',
plugins,
// https://github.com/getsentry/sentry-electron/issues/416
optimization: {
sideEffects: false,
},
};
};

Expand Down
Loading