Skip to content

Commit abff9ae

Browse files
authored
feat: Update express app to v8.0.0-beta.3 (#14)
1 parent 0498d1e commit abff9ae

15 files changed

+2189
-462
lines changed

apps/express/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"extends": "../../package.json"
1616
},
1717
"dependencies": {
18-
"@sentry/node": "7.110.1",
18+
"@sentry/node": "8.0.0-beta.3",
1919
"dotenv": "^16.4.5",
2020
"express": "^4.19.2"
2121
},

apps/express/src/app.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as Sentry from '@sentry/node';
2-
import express from 'express';
2+
33
import dotenv from 'dotenv';
44

55
dotenv.config({ path: './../../.env' });
@@ -10,8 +10,6 @@ declare global {
1010
}
1111
}
1212

13-
const app = express();
14-
const port = 3030;
1513

1614
Sentry.init({
1715
environment: 'qa', // dynamic sampling bias to keep transactions
@@ -20,11 +18,14 @@ Sentry.init({
2018
debug: true,
2119
tunnel: `http://localhost:3031/`, // proxy server
2220
tracesSampleRate: 1,
23-
integrations: [new Sentry.Integrations.Express({ app })],
2421
});
2522

26-
app.use(Sentry.Handlers.requestHandler());
27-
app.use(Sentry.Handlers.tracingHandler());
23+
import express from 'express';
24+
25+
const app = express();
26+
const port = 3030;
27+
28+
Sentry.setupExpressErrorHandler(app);
2829

2930
app.get('/test-success', function (req, res) {
3031
res.send({ version: 'v1' });
@@ -94,8 +95,6 @@ app.get('/test-local-variables-caught', function (req, res) {
9495
res.send({ exceptionId, randomVariableToRecord });
9596
});
9697

97-
app.use(Sentry.Handlers.errorHandler());
98-
9998
// @ts-ignore
10099
app.use(function onError(err, req, res, next) {
101100
// The error id is attached to `res.sentry` to be returned

payload-files/express/test-error--event.json

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"event_id": "[[ID1]]",
55
"sdk": {
66
"name": "sentry.javascript.node",
7-
"version": "7.110.1"
7+
"version": "8.0.0-beta.3"
88
},
99
"sent_at": "[[ISODateString]]",
1010
"trace": {
@@ -58,14 +58,6 @@
5858
"version": "v20.12.1"
5959
},
6060
"trace": {
61-
"data": {
62-
"sentry.op": "http.server",
63-
"sentry.origin": "auto.http.node.tracingHandler",
64-
"sentry.sample_rate": 1,
65-
"sentry.source": "route"
66-
},
67-
"op": "http.server",
68-
"origin": "auto.http.node.tracingHandler",
6961
"span_id": "[[ID3]]",
7062
"trace_id": "[[ID2]]"
7163
}
@@ -166,9 +158,9 @@
166158
"colno": 12,
167159
"context_line": " return __awaiter(this, void 0, void 0, function () {",
168160
"filename": "[[FILENAME3]]",
169-
"function": "<anonymous>",
161+
"function": "?",
170162
"in_app": true,
171-
"lineno": 86,
163+
"lineno": 84,
172164
"module": "app",
173165
"post_context": [
174166
" var exceptionId;",
@@ -180,9 +172,9 @@
180172
" case 1:"
181173
],
182174
"pre_context": [
183-
"});",
184-
"app.use(Sentry.Handlers.requestHandler());",
185-
"app.use(Sentry.Handlers.tracingHandler());",
175+
"var app = (0, express_1.default)();",
176+
"var port = 3030;",
177+
"Sentry.setupExpressErrorHandler(app);",
186178
"app.get('/test-success', function (req, res) {",
187179
" res.send({ version: 'v1' });",
188180
"});",
@@ -226,7 +218,7 @@
226218
"colno": 71,
227219
"context_line": " step((generator = generator.apply(thisArg, _arguments || [])).next());",
228220
"filename": "[[FILENAME3]]",
229-
"function": "<anonymous>",
221+
"function": "?",
230222
"in_app": true,
231223
"lineno": 31,
232224
"module": "app",
@@ -307,9 +299,9 @@
307299
"colno": 59,
308300
"context_line": " exceptionId = Sentry.captureException(new Error('This is an error'));",
309301
"filename": "[[FILENAME3]]",
310-
"function": "<anonymous>",
302+
"function": "?",
311303
"in_app": true,
312-
"lineno": 91,
304+
"lineno": 89,
313305
"module": "app",
314306
"post_context": [
315307
" return [4 /*yield*/, Sentry.flush(2000)];",
@@ -347,6 +339,7 @@
347339
"content-type": "1.0.5",
348340
"cookie": "0.6.0",
349341
"cookie-signature": "1.0.6",
342+
"debug": "4.3.4",
350343
"define-data-property": "1.1.4",
351344
"depd": "2.0.0",
352345
"destroy": "1.2.0",
@@ -370,37 +363,47 @@
370363
"hasown": "2.0.2",
371364
"http-errors": "2.0.0",
372365
"iconv-lite": "0.4.24",
366+
"import-in-the-middle": "1.7.1",
373367
"inherits": "2.0.4",
374368
"ipaddr.js": "1.9.1",
369+
"is-core-module": "2.13.1",
375370
"media-typer": "0.3.0",
376371
"merge-descriptors": "1.0.1",
377372
"methods": "1.1.2",
378373
"mime": "1.6.0",
379374
"mime-db": "1.52.0",
380375
"mime-types": "2.1.35",
376+
"module-details-from-path": "1.0.3",
381377
"ms": "2.1.3",
382378
"negotiator": "0.6.3",
383379
"object-inspect": "1.13.1",
384380
"on-finished": "2.4.1",
381+
"opentelemetry-instrumentation-fetch-node": "1.2.0",
385382
"parseurl": "1.3.3",
386383
"path-to-regexp": "0.1.7",
387384
"proxy-addr": "2.0.7",
388385
"qs": "6.11.0",
389386
"range-parser": "1.2.1",
390387
"raw-body": "2.5.2",
388+
"require-in-the-middle": "7.3.0",
389+
"resolve": "1.22.8",
391390
"safe-buffer": "5.2.1",
392391
"safer-buffer": "2.1.2",
392+
"semver": "7.6.0",
393393
"send": "0.18.0",
394394
"serve-static": "1.15.0",
395395
"set-function-length": "1.2.2",
396396
"setprototypeof": "1.2.0",
397+
"shimmer": "1.2.1",
397398
"side-channel": "1.0.6",
398399
"statuses": "2.0.1",
400+
"supports-color": "5.5.0",
399401
"toidentifier": "1.0.1",
400402
"type-is": "1.6.18",
401403
"unpipe": "1.0.0",
402404
"utils-merge": "1.0.1",
403-
"vary": "1.1.2"
405+
"vary": "1.1.2",
406+
"yallist": "4.0.0"
404407
},
405408
"platform": "node",
406409
"request": {
@@ -415,7 +418,7 @@
415418
"cookie": "sc=2pGHpwfeQfLDqPcR9gwpxKl0DHTlOKYq",
416419
"host": "localhost:3030",
417420
"if-none-match": "[[W/entityTagValue]]",
418-
"sec-ch-ua": "\"Google Chrome\";v=\"123\", \"Not:A-Brand\";v=\"8\", \"Chromium\";v=\"123\"",
421+
"sec-ch-ua": "\"Chromium\";v=\"124\", \"Google Chrome\";v=\"124\", \"Not-A.Brand\";v=\"99\"",
419422
"sec-ch-ua-mobile": "?0",
420423
"sec-ch-ua-platform": "\"macOS\"",
421424
"sec-fetch-dest": "document",
@@ -426,7 +429,6 @@
426429
"user-agent": "[[user-agent]]"
427430
},
428431
"method": "GET",
429-
"query_string": {},
430432
"url": "http://localhost:3030/test-error"
431433
},
432434
"sdk": {
@@ -437,28 +439,36 @@
437439
"RequestData",
438440
"Console",
439441
"Http",
440-
"Undici",
442+
"NodeFetch",
441443
"OnUncaughtException",
442444
"OnUnhandledRejection",
443445
"ContextLines",
444-
"LocalVariables",
446+
"LocalVariablesAsync",
445447
"Context",
446448
"Modules",
447-
"Express"
449+
"Express",
450+
"Fastify",
451+
"Graphql",
452+
"Mongo",
453+
"Mongoose",
454+
"Mysql",
455+
"Mysql2",
456+
"Postgres",
457+
"Nest",
458+
"Hapi",
459+
"Koa",
460+
"Connect"
448461
],
449462
"name": "sentry.javascript.node",
450463
"packages": [
451464
{
452465
"name": "npm:@sentry/node",
453-
"version": "7.110.1"
466+
"version": "8.0.0-beta.3"
454467
}
455468
],
456-
"version": "7.110.1"
469+
"version": "8.0.0-beta.3"
457470
},
458471
"server_name": "JH0G94X29Q.local",
459-
"tags": {
460-
"transaction": "GET /test-error"
461-
},
462472
"timestamp": "[[timestamp]]",
463473
"transaction": "GET /test-error"
464474
}

0 commit comments

Comments
 (0)