-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #137 from baruchiro/SentryReportProblem
Sentry report problem
- Loading branch information
Showing
14 changed files
with
362 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = [ | ||
'SENTRY_DSN', | ||
'GOOGLE_CLIENT_ID', | ||
'GOOGLE_CLIENT_SECRET', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
#!/usr/bin/env node | ||
|
||
/* | ||
To upload debug information for native crashes when updating Electron, run: | ||
npm install --save-dev @sentry/cli electron-download | ||
node sentry-symbols.js | ||
For more information, see https://docs.sentry.io/clients/electron/ | ||
*/ | ||
let SentryCli; | ||
let download; | ||
|
||
try { | ||
SentryCli = require('@sentry/cli'); | ||
download = require('electron-download'); | ||
} catch (e) { | ||
console.error('ERROR: Missing required packages, please run:'); | ||
console.error('npm install --save-dev @sentry/cli electron-download'); | ||
process.exit(1); | ||
} | ||
|
||
const VERSION = /\bv?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\da-z-]+(?:\.[\da-z-]+)*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?\b/i; | ||
const SYMBOL_CACHE_FOLDER = '.electron-symbols'; | ||
const package = require('./package.json'); | ||
const sentryCli = new SentryCli('./sentry.properties'); | ||
|
||
async function main() { | ||
let version = getElectronVersion(); | ||
if (!version) { | ||
console.error('Cannot detect electron version, check package.json'); | ||
return; | ||
} | ||
|
||
console.log('We are starting to download all possible electron symbols'); | ||
console.log('We need it in order to symbolicate native crashes'); | ||
console.log( | ||
'This step is only needed once whenever you update your electron version', | ||
); | ||
console.log('Just call this script again it should do everything for you.'); | ||
|
||
let zipPath = await downloadSymbols({ | ||
version, | ||
platform: 'darwin', | ||
arch: 'x64', | ||
dsym: true, | ||
}); | ||
await sentryCli.execute(['upload-dif', '-t', 'dsym', zipPath], true); | ||
|
||
zipPath = await downloadSymbols({ | ||
version, | ||
platform: 'win32', | ||
arch: 'ia32', | ||
symbols: true, | ||
}); | ||
await sentryCli.execute(['upload-dif', '-t', 'breakpad', zipPath], true); | ||
|
||
zipPath = await downloadSymbols({ | ||
version, | ||
platform: 'win32', | ||
arch: 'x64', | ||
symbols: true, | ||
}); | ||
await sentryCli.execute(['upload-dif', '-t', 'breakpad', zipPath], true); | ||
|
||
zipPath = await downloadSymbols({ | ||
version, | ||
platform: 'linux', | ||
arch: 'x64', | ||
symbols: true, | ||
}); | ||
await sentryCli.execute(['upload-dif', '-t', 'breakpad', zipPath], true); | ||
|
||
console.log('Finished downloading and uploading to Sentry'); | ||
console.log(`Feel free to delete the ${SYMBOL_CACHE_FOLDER}`); | ||
} | ||
|
||
function getElectronVersion() { | ||
if (!package) { | ||
return false; | ||
} | ||
|
||
let electronVersion = | ||
(package.dependencies && package.dependencies.electron) || | ||
(package.devDependencies && package.devDependencies.electron); | ||
|
||
if (!electronVersion) { | ||
return false; | ||
} | ||
|
||
const matches = VERSION.exec(electronVersion); | ||
return matches ? matches[0] : false; | ||
} | ||
|
||
async function downloadSymbols(options) { | ||
return new Promise((resolve, reject) => { | ||
download( | ||
{ | ||
...options, | ||
cache: SYMBOL_CACHE_FOLDER, | ||
}, | ||
(err, zipPath) => { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve(zipPath); | ||
} | ||
}, | ||
); | ||
}); | ||
} | ||
|
||
main().catch(e => console.error(e)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import * as Sentry from '@sentry/electron'; | ||
|
||
// https://github.com/getsentry/sentry-electron/issues/142 | ||
const { init } = (process.type === 'browser' | ||
? require('@sentry/electron/dist/main') | ||
: require('@sentry/electron/dist/renderer')); | ||
|
||
|
||
const reporterConfiguration = { | ||
dsn: SENTRY_DSN, | ||
defaultIntegrations: false, | ||
environment: process.env.NODE_ENV, | ||
enableJavaScript: false, | ||
enableNative: false, | ||
enableUnresponsive: false, | ||
}; | ||
|
||
export function initializeReporter() { | ||
init(reporterConfiguration); | ||
} | ||
|
||
export function ReportProblem(title, body, logs, email, extra) { | ||
return Sentry.captureEvent({ | ||
message: title, | ||
logger: logs, | ||
user: { | ||
email, | ||
}, | ||
extra: { | ||
body, | ||
...extra, | ||
}, | ||
}); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.