mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #2650 from overleaf/revert-2570-as-sentry-source-maps
Revert "Upload source maps to Sentry" GitOrigin-RevId: 6f6a122209553b9fde664ff55ebec37f7cb6ef7e
This commit is contained in:
parent
a11a4ac614
commit
ad361a6617
9 changed files with 403 additions and 1000 deletions
3
services/web/.gitignore
vendored
3
services/web/.gitignore
vendored
|
@ -59,6 +59,3 @@ docker-shared.yml
|
||||||
config/*.coffee
|
config/*.coffee
|
||||||
|
|
||||||
modules/**/Makefile
|
modules/**/Makefile
|
||||||
|
|
||||||
# Sentry secrets file (injected by CI)
|
|
||||||
.sentryclirc
|
|
||||||
|
|
|
@ -13,12 +13,6 @@ RUN npm install --quiet
|
||||||
|
|
||||||
COPY . /app
|
COPY . /app
|
||||||
|
|
||||||
# Set environment variables for Sentry
|
|
||||||
ARG SENTRY_RELEASE
|
|
||||||
ARG BRANCH_NAME
|
|
||||||
ENV SENTRY_RELEASE=$SENTRY_RELEASE
|
|
||||||
ENV BRANCH_NAME=$BRANCH_NAME
|
|
||||||
|
|
||||||
RUN chmod 0755 ./install_deps.sh && ./install_deps.sh
|
RUN chmod 0755 ./install_deps.sh && ./install_deps.sh
|
||||||
|
|
||||||
FROM base
|
FROM base
|
||||||
|
|
|
@ -136,8 +136,6 @@ lint:
|
||||||
build:
|
build:
|
||||||
docker build --pull --tag ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \
|
docker build --pull --tag ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \
|
||||||
--tag gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \
|
--tag gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \
|
||||||
--build-arg SENTRY_RELEASE=${COMMIT_SHA} \
|
|
||||||
--build-arg BRANCH_NAME=$(BRANCH_NAME) \
|
|
||||||
.
|
.
|
||||||
|
|
||||||
build_test_frontend:
|
build_test_frontend:
|
||||||
|
|
|
@ -365,8 +365,7 @@ module.exports = function(webRouter, privateApiRouter, publicApiRouter) {
|
||||||
Settings.recaptcha != null ? Settings.recaptcha.siteKeyV3 : undefined,
|
Settings.recaptcha != null ? Settings.recaptcha.siteKeyV3 : undefined,
|
||||||
recaptchaDisabled:
|
recaptchaDisabled:
|
||||||
Settings.recaptcha != null ? Settings.recaptcha.disabled : undefined,
|
Settings.recaptcha != null ? Settings.recaptcha.disabled : undefined,
|
||||||
validRootDocExtensions: Settings.validRootDocExtensions,
|
validRootDocExtensions: Settings.validRootDocExtensions
|
||||||
sentryDsn: Settings.sentry != null ? Settings.sentry.publicDSN : undefined
|
|
||||||
}
|
}
|
||||||
next()
|
next()
|
||||||
})
|
})
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
__webpack_public_path__ = window.baseAssetPath
|
__webpack_public_path__ = window.baseAssetPath
|
||||||
|
|
||||||
define([
|
define([
|
||||||
'utils/sentry',
|
|
||||||
'libraries',
|
'libraries',
|
||||||
'modules/recursionHelper',
|
'modules/recursionHelper',
|
||||||
'modules/errorCatcher',
|
'modules/errorCatcher',
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
// Conditionally enable Sentry based on whether the DSN token is set
|
|
||||||
if (window.ExposedSettings.sentryDsn) {
|
|
||||||
import(/* webpackChunkName: "sentry" */ '@sentry/browser').then(Sentry => {
|
|
||||||
Sentry.init({
|
|
||||||
dsn: window.ExposedSettings.sentryDsn,
|
|
||||||
|
|
||||||
// Ignore errors unless they come from overleaf.com/sharelatex.com
|
|
||||||
// Adapted from: https://docs.sentry.io/platforms/javascript/#decluttering-sentry
|
|
||||||
whitelistUrls: [
|
|
||||||
/https:\/\/[a-z]+\.overleaf\.com/,
|
|
||||||
/https:\/\/[a-z]+\.sharelatex\.com/
|
|
||||||
]
|
|
||||||
})
|
|
||||||
|
|
||||||
// Previously Raven added itself as a global, so we mimic that old behaviour
|
|
||||||
window.Raven = Sentry
|
|
||||||
})
|
|
||||||
}
|
|
1244
services/web/package-lock.json
generated
1244
services/web/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -33,7 +33,6 @@
|
||||||
"@babel/preset-env": "^7.5.5",
|
"@babel/preset-env": "^7.5.5",
|
||||||
"@babel/preset-react": "^7.0.0",
|
"@babel/preset-react": "^7.0.0",
|
||||||
"@overleaf/o-error": "^2.1.0",
|
"@overleaf/o-error": "^2.1.0",
|
||||||
"@sentry/browser": "^5.12.0",
|
|
||||||
"algoliasearch": "^3.35.1",
|
"algoliasearch": "^3.35.1",
|
||||||
"angular": "~1.6.10",
|
"angular": "~1.6.10",
|
||||||
"angular-sanitize": "~1.6.10",
|
"angular-sanitize": "~1.6.10",
|
||||||
|
@ -124,7 +123,6 @@
|
||||||
"yauzl": "^2.10.0"
|
"yauzl": "^2.10.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sentry/webpack-plugin": "^1.9.3",
|
|
||||||
"acorn": "^6.1.0",
|
"acorn": "^6.1.0",
|
||||||
"acorn-walk": "^6.1.1",
|
"acorn-walk": "^6.1.1",
|
||||||
"angular-mocks": "~1.6.10",
|
"angular-mocks": "~1.6.10",
|
||||||
|
@ -175,7 +173,6 @@
|
||||||
"postcss-loader": "^3.0.0",
|
"postcss-loader": "^3.0.0",
|
||||||
"prettier-eslint-cli": "^4.7.1",
|
"prettier-eslint-cli": "^4.7.1",
|
||||||
"react-testing-library": "^5.4.2",
|
"react-testing-library": "^5.4.2",
|
||||||
"remove-files-webpack-plugin": "^1.2.2",
|
|
||||||
"requirejs": "^2.1.22",
|
"requirejs": "^2.1.22",
|
||||||
"sandboxed-module": "0.2.0",
|
"sandboxed-module": "0.2.0",
|
||||||
"sinon": "^7.5.0",
|
"sinon": "^7.5.0",
|
||||||
|
|
|
@ -1,18 +1,13 @@
|
||||||
const fs = require('fs')
|
|
||||||
const merge = require('webpack-merge')
|
const merge = require('webpack-merge')
|
||||||
const TerserPlugin = require('terser-webpack-plugin')
|
const TerserPlugin = require('terser-webpack-plugin')
|
||||||
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin')
|
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin')
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||||
const SentryPlugin = require('@sentry/webpack-plugin')
|
|
||||||
const RemoveFilesPlugin = require('remove-files-webpack-plugin')
|
|
||||||
|
|
||||||
const base = require('./webpack.config')
|
const base = require('./webpack.config')
|
||||||
|
|
||||||
// Use "smart" merge: attempts to combine loaders targeting the same file type,
|
// Use "smart" merge: attempts to combine loaders targeting the same file type,
|
||||||
// overriding the base config
|
// overriding the base config
|
||||||
module.exports = merge.smart(
|
module.exports = merge.smart(base, {
|
||||||
base,
|
|
||||||
{
|
|
||||||
mode: 'production',
|
mode: 'production',
|
||||||
|
|
||||||
// Enable a full source map. Generates a comment linking to the source map
|
// Enable a full source map. Generates a comment linking to the source map
|
||||||
|
@ -51,54 +46,8 @@ module.exports = merge.smart(
|
||||||
plugins: [
|
plugins: [
|
||||||
// Extract CSS to a separate file (rather than inlining to a <style> tag)
|
// Extract CSS to a separate file (rather than inlining to a <style> tag)
|
||||||
new MiniCssExtractPlugin({
|
new MiniCssExtractPlugin({
|
||||||
// Output to public/stylesheets directory and append hash for immutable
|
// Output to public/stylesheets directory and append hash for immutable caching
|
||||||
// caching
|
|
||||||
filename: 'stylesheets/[name]-[chunkhash].css'
|
filename: 'stylesheets/[name]-[chunkhash].css'
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
},
|
})
|
||||||
// Conditionally merge in Sentry plugins
|
|
||||||
generateSentryConfig()
|
|
||||||
)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If Sentry secrets file exists, then configure SentryPlugin to upload source
|
|
||||||
* maps to Sentry
|
|
||||||
*/
|
|
||||||
function generateSentryConfig() {
|
|
||||||
// Only upload if the Sentry secrets file is available and on master branch
|
|
||||||
if (
|
|
||||||
fs.existsSync('./.sentryclirc') &&
|
|
||||||
process.env['BRANCH_NAME'] === 'master'
|
|
||||||
) {
|
|
||||||
console.log('Sentry secrets file found. Uploading source maps to Sentry')
|
|
||||||
return {
|
|
||||||
plugins: [
|
|
||||||
new SentryPlugin({
|
|
||||||
release: process.env['SENTRY_RELEASE'],
|
|
||||||
include: './public/js',
|
|
||||||
ignore: ['ace-1.4.5', 'cmaps', 'libs']
|
|
||||||
}),
|
|
||||||
|
|
||||||
// After uploading source maps to Sentry, delete them. Some of the
|
|
||||||
// source maps are of proprietary code and so we don't want to make them
|
|
||||||
// publicly available
|
|
||||||
new RemoveFilesPlugin({
|
|
||||||
after: {
|
|
||||||
test: [
|
|
||||||
{
|
|
||||||
folder: './public/js',
|
|
||||||
method: filePath => /\.map$/.test(filePath)
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
]
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log(
|
|
||||||
'Sentry secrets file not found. NOT uploading source maps to Sentry'
|
|
||||||
)
|
|
||||||
return {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue