Skip to content

Update express app from v7 to v8.0.0-beta.3 #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 23, 2024
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
2 changes: 1 addition & 1 deletion apps/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"extends": "../../package.json"
},
"dependencies": {
"@sentry/node": "7.110.1",
"@sentry/node": "8.0.0-beta.3",
"dotenv": "^16.4.5",
"express": "^4.19.2"
},
Expand Down
15 changes: 7 additions & 8 deletions apps/express/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Sentry from '@sentry/node';
import express from 'express';

import dotenv from 'dotenv';

dotenv.config({ path: './../../.env' });
Expand All @@ -10,8 +10,6 @@ declare global {
}
}

const app = express();
const port = 3030;

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

app.use(Sentry.Handlers.requestHandler());
app.use(Sentry.Handlers.tracingHandler());
import express from 'express';

const app = express();
const port = 3030;

Sentry.setupExpressErrorHandler(app);

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

app.use(Sentry.Handlers.errorHandler());

// @ts-ignore
app.use(function onError(err, req, res, next) {
// The error id is attached to `res.sentry` to be returned
Expand Down
66 changes: 38 additions & 28 deletions payload-files/express/test-error--event.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"event_id": "[[ID1]]",
"sdk": {
"name": "sentry.javascript.node",
"version": "7.110.1"
"version": "8.0.0-beta.3"
},
"sent_at": "[[ISODateString]]",
"trace": {
Expand Down Expand Up @@ -58,14 +58,6 @@
"version": "v20.12.1"
},
"trace": {
"data": {
"sentry.op": "http.server",
"sentry.origin": "auto.http.node.tracingHandler",
"sentry.sample_rate": 1,
"sentry.source": "route"
},
"op": "http.server",
"origin": "auto.http.node.tracingHandler",
"span_id": "[[ID3]]",
"trace_id": "[[ID2]]"
}
Expand Down Expand Up @@ -166,9 +158,9 @@
"colno": 12,
"context_line": " return __awaiter(this, void 0, void 0, function () {",
"filename": "[[FILENAME3]]",
"function": "<anonymous>",
"function": "?",
"in_app": true,
"lineno": 86,
"lineno": 84,
"module": "app",
"post_context": [
" var exceptionId;",
Expand All @@ -180,9 +172,9 @@
" case 1:"
],
"pre_context": [
"});",
"app.use(Sentry.Handlers.requestHandler());",
"app.use(Sentry.Handlers.tracingHandler());",
"var app = (0, express_1.default)();",
"var port = 3030;",
"Sentry.setupExpressErrorHandler(app);",
"app.get('/test-success', function (req, res) {",
" res.send({ version: 'v1' });",
"});",
Expand Down Expand Up @@ -226,7 +218,7 @@
"colno": 71,
"context_line": " step((generator = generator.apply(thisArg, _arguments || [])).next());",
"filename": "[[FILENAME3]]",
"function": "<anonymous>",
"function": "?",
"in_app": true,
"lineno": 31,
"module": "app",
Expand Down Expand Up @@ -307,9 +299,9 @@
"colno": 59,
"context_line": " exceptionId = Sentry.captureException(new Error('This is an error'));",
"filename": "[[FILENAME3]]",
"function": "<anonymous>",
"function": "?",
"in_app": true,
"lineno": 91,
"lineno": 89,
"module": "app",
"post_context": [
" return [4 /*yield*/, Sentry.flush(2000)];",
Expand Down Expand Up @@ -347,6 +339,7 @@
"content-type": "1.0.5",
"cookie": "0.6.0",
"cookie-signature": "1.0.6",
"debug": "4.3.4",
"define-data-property": "1.1.4",
"depd": "2.0.0",
"destroy": "1.2.0",
Expand All @@ -370,37 +363,47 @@
"hasown": "2.0.2",
"http-errors": "2.0.0",
"iconv-lite": "0.4.24",
"import-in-the-middle": "1.7.1",
"inherits": "2.0.4",
"ipaddr.js": "1.9.1",
"is-core-module": "2.13.1",
"media-typer": "0.3.0",
"merge-descriptors": "1.0.1",
"methods": "1.1.2",
"mime": "1.6.0",
"mime-db": "1.52.0",
"mime-types": "2.1.35",
"module-details-from-path": "1.0.3",
"ms": "2.1.3",
"negotiator": "0.6.3",
"object-inspect": "1.13.1",
"on-finished": "2.4.1",
"opentelemetry-instrumentation-fetch-node": "1.2.0",
"parseurl": "1.3.3",
"path-to-regexp": "0.1.7",
"proxy-addr": "2.0.7",
"qs": "6.11.0",
"range-parser": "1.2.1",
"raw-body": "2.5.2",
"require-in-the-middle": "7.3.0",
"resolve": "1.22.8",
"safe-buffer": "5.2.1",
"safer-buffer": "2.1.2",
"semver": "7.6.0",
"send": "0.18.0",
"serve-static": "1.15.0",
"set-function-length": "1.2.2",
"setprototypeof": "1.2.0",
"shimmer": "1.2.1",
"side-channel": "1.0.6",
"statuses": "2.0.1",
"supports-color": "5.5.0",
"toidentifier": "1.0.1",
"type-is": "1.6.18",
"unpipe": "1.0.0",
"utils-merge": "1.0.1",
"vary": "1.1.2"
"vary": "1.1.2",
"yallist": "4.0.0"
},
"platform": "node",
"request": {
Expand All @@ -415,7 +418,7 @@
"cookie": "sc=2pGHpwfeQfLDqPcR9gwpxKl0DHTlOKYq",
"host": "localhost:3030",
"if-none-match": "[[W/entityTagValue]]",
"sec-ch-ua": "\"Google Chrome\";v=\"123\", \"Not:A-Brand\";v=\"8\", \"Chromium\";v=\"123\"",
"sec-ch-ua": "\"Chromium\";v=\"124\", \"Google Chrome\";v=\"124\", \"Not-A.Brand\";v=\"99\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"macOS\"",
"sec-fetch-dest": "document",
Expand All @@ -426,7 +429,6 @@
"user-agent": "[[user-agent]]"
},
"method": "GET",
"query_string": {},
"url": "http://localhost:3030/test-error"
},
"sdk": {
Expand All @@ -437,28 +439,36 @@
"RequestData",
"Console",
"Http",
"Undici",
"NodeFetch",
"OnUncaughtException",
"OnUnhandledRejection",
"ContextLines",
"LocalVariables",
"LocalVariablesAsync",
"Context",
"Modules",
"Express"
"Express",
"Fastify",
"Graphql",
"Mongo",
"Mongoose",
"Mysql",
"Mysql2",
"Postgres",
"Nest",
"Hapi",
"Koa",
"Connect"
],
"name": "sentry.javascript.node",
"packages": [
{
"name": "npm:@sentry/node",
"version": "7.110.1"
"version": "8.0.0-beta.3"
}
],
"version": "7.110.1"
"version": "8.0.0-beta.3"
},
"server_name": "JH0G94X29Q.local",
"tags": {
"transaction": "GET /test-error"
},
"timestamp": "[[timestamp]]",
"transaction": "GET /test-error"
}
Expand Down
Loading