Skip to content

Commit d6d75e0

Browse files
committed
Add bugsnag in HTML, bugfix sourcemaps
1 parent b4180a4 commit d6d75e0

File tree

5 files changed

+9
-60
lines changed

5 files changed

+9
-60
lines changed

web/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"dependencies": {
66
"@sentry/browser": "4.0.6",
77
"basic-auth": "^2.0.0",
8-
"bugsnag-js": "^4.7.3",
98
"compression": "^1.7.2",
109
"currency-symbol-map": "^4.0.3",
1110
"d3-array": "^1.2.1",

web/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ app.all('/dist/*.map', (req, res, next) => {
210210
'104.155.159.182',
211211
'104.155.149.19',
212212
'130.211.230.102',
213-
].index(req.headers['x-forwarded-for']) !== -1) {
213+
].indexOf(req.headers['x-forwarded-for']) !== -1) {
214214
return res.status(401).json({ error: 'unauthorized' });
215215
}
216216
return next();

web/src/services/thirdparty.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
import bugsnag from 'bugsnag-js';
21
import * as Sentry from '@sentry/browser';
32

43
const store = require('../store');
54

6-
const bugsnagClient = bugsnag({
7-
apiKey: 'ab57d4f7207c97344bc61a8c2e48d176',
8-
appVersion: store.getState().application.bundleHash,
9-
});
5+
const { bugsnagClient } = window;
106

117
Sentry.init({
128
dsn: 'https://[email protected]/1295430',

web/views/pages/index.ejs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ co2Sub = function(str) {
6868
<link rel="canonical" href="<%- fullUrl %>" />
6969
<% } %>
7070

71+
<!-- Add crash reporting early on so we catch all errors -->
72+
<script src="//d2wy8f7a9ursnm.cloudfront.net/v4/bugsnag.min.js"></script>
73+
<script>window.bugsnagClient = bugsnag('ab57d4f7207c97344bc61a8c2e48d176')</script>
74+
7175
<!-- Google App Indexing (Android) -->
7276
<link rel="alternate" href="android-app://com.tmrow.electricitymap/https/electricitymap.org" />
7377
<link rel="alternate" href="android-app://com.tmrow.electricitymap/http/electricitymap.org" />

web/yarn.lock

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22
# yarn lockfile v1
33

44

5-
"@bugsnag/cuid@^3.0.0":
6-
version "3.0.0"
7-
resolved "http://registry.npmjs.org/@bugsnag/cuid/-/cuid-3.0.0.tgz#2ee7642a30aee6dc86f5e7f824653741e42e5c35"
8-
9-
"@bugsnag/safe-json-stringify@^2.1.0":
10-
version "2.1.0"
11-
resolved "https://registry.yarnpkg.com/@bugsnag/safe-json-stringify/-/safe-json-stringify-2.1.0.tgz#c7dd30a33bd888c39cd36d45216f7252f307ed36"
12-
135
146
version "0.2.2"
157
resolved "https://registry.yarnpkg.com/@mapbox/geojson-area/-/geojson-area-0.2.2.tgz#18d7814aa36bf23fbbcc379f8e26a22927debf10"
@@ -1376,13 +1368,6 @@ browserify-sign@^4.0.0:
13761368
inherits "^2.0.1"
13771369
parse-asn1 "^5.0.0"
13781370

1379-
browserify-versionify@^1.0.6:
1380-
version "1.0.6"
1381-
resolved "https://registry.yarnpkg.com/browserify-versionify/-/browserify-versionify-1.0.6.tgz#ab2dc61d6a119e627bec487598d1983b7fdb275e"
1382-
dependencies:
1383-
find-root "^0.1.1"
1384-
through2 "0.6.3"
1385-
13861371
browserify-zlib@^0.2.0:
13871372
version "0.2.0"
13881373
resolved "https://registry.yarnpkg.com/browserify-zlib/-/browserify-zlib-0.2.0.tgz#2869459d9aa3be245fe8fe2ca1f46e2e7f54d73f"
@@ -1431,17 +1416,6 @@ buffer@^4.3.0:
14311416
ieee754 "^1.1.4"
14321417
isarray "^1.0.0"
14331418

1434-
bugsnag-js@^4.7.3:
1435-
version "4.7.3"
1436-
resolved "https://registry.yarnpkg.com/bugsnag-js/-/bugsnag-js-4.7.3.tgz#fd81eed6882b629d5f059de5bc916ecd19c82aa1"
1437-
dependencies:
1438-
"@bugsnag/cuid" "^3.0.0"
1439-
"@bugsnag/safe-json-stringify" "^2.1.0"
1440-
browserify-versionify "^1.0.6"
1441-
error-stack-parser "^2.0.2"
1442-
iserror "0.0.2"
1443-
stack-generator "^2.0.3"
1444-
14451419
builtin-modules@^1.0.0:
14461420
version "1.1.1"
14471421
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"
@@ -2627,7 +2601,7 @@ error-ex@^1.2.0, error-ex@^1.3.1:
26272601
dependencies:
26282602
is-arrayish "^0.2.1"
26292603

2630-
error-stack-parser@^2.0.1, error-stack-parser@^2.0.2:
2604+
error-stack-parser@^2.0.1:
26312605
version "2.0.2"
26322606
resolved "https://registry.yarnpkg.com/error-stack-parser/-/error-stack-parser-2.0.2.tgz#4ae8dbaa2bf90a8b450707b9149dcabca135520d"
26332607
dependencies:
@@ -3172,10 +3146,6 @@ find-npm-prefix@^1.0.2:
31723146
version "1.0.2"
31733147
resolved "https://registry.yarnpkg.com/find-npm-prefix/-/find-npm-prefix-1.0.2.tgz#8d8ce2c78b3b4b9e66c8acc6a37c231eb841cfdf"
31743148

3175-
find-root@^0.1.1:
3176-
version "0.1.2"
3177-
resolved "https://registry.yarnpkg.com/find-root/-/find-root-0.1.2.tgz#98d2267cff1916ccaf2743b3a0eea81d79d7dcd1"
3178-
31793149
find-up@^1.0.0:
31803150
version "1.1.2"
31813151
resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f"
@@ -4252,10 +4222,6 @@ isbinaryfile@^3.0.2:
42524222
dependencies:
42534223
buffer-alloc "^1.2.0"
42544224

4255-
4256-
version "0.0.2"
4257-
resolved "https://registry.yarnpkg.com/iserror/-/iserror-0.0.2.tgz#bd53451fe2f668b9f2402c1966787aaa2c7c0bf5"
4258-
42594225
isexe@^2.0.0:
42604226
version "2.0.0"
42614227
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
@@ -6613,15 +6579,6 @@ read@1, read@~1.0.1, read@~1.0.7:
66136579
string_decoder "~1.1.1"
66146580
util-deprecate "~1.0.1"
66156581

6616-
"readable-stream@>=1.0.33-1 <1.1.0-0":
6617-
version "1.0.34"
6618-
resolved "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c"
6619-
dependencies:
6620-
core-util-is "~1.0.0"
6621-
inherits "~2.0.1"
6622-
isarray "0.0.1"
6623-
string_decoder "~0.10.x"
6624-
66256582
readable-stream@~1.1.0, readable-stream@~1.1.10:
66266583
version "1.1.14"
66276584
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9"
@@ -7392,7 +7349,7 @@ ssri@^6.0.0:
73927349
version "6.0.0"
73937350
resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.0.tgz#fc21bfc90e03275ac3e23d5a42e38b8a1cbc130d"
73947351

7395-
stack-generator@^2.0.1, stack-generator@^2.0.3:
7352+
stack-generator@^2.0.1:
73967353
version "2.0.3"
73977354
resolved "https://registry.yarnpkg.com/stack-generator/-/stack-generator-2.0.3.tgz#bb74385c67ffc4ccf3c4dee5831832d4e509c8a0"
73987355
dependencies:
@@ -7708,13 +7665,6 @@ textextensions@2:
77087665
version "2.2.0"
77097666
resolved "https://registry.yarnpkg.com/textextensions/-/textextensions-2.2.0.tgz#38ac676151285b658654581987a0ce1a4490d286"
77107667

7711-
7712-
version "0.6.3"
7713-
resolved "https://registry.yarnpkg.com/through2/-/through2-0.6.3.tgz#795292fde9f254c2a368b38f9cc5d1bd4663afb6"
7714-
dependencies:
7715-
readable-stream ">=1.0.33-1 <1.1.0-0"
7716-
xtend ">=4.0.0 <4.1.0-0"
7717-
77187668
through2@^2.0.0, through2@~2.0.3:
77197669
version "2.0.3"
77207670
resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be"
@@ -8316,7 +8266,7 @@ xregexp@^2.0.0:
83168266
version "2.0.0"
83178267
resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-2.0.0.tgz#52a63e56ca0b84a7f3a5f3d61872f126ad7a5943"
83188268

8319-
"xtend@>=4.0.0 <4.1.0-0", xtend@^4.0.0, xtend@~4.0.0, xtend@~4.0.1:
8269+
xtend@^4.0.0, xtend@~4.0.0, xtend@~4.0.1:
83208270
version "4.0.1"
83218271
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"
83228272

0 commit comments

Comments
 (0)