Skip to content

Commit 8786b70

Browse files
committed
hapi v8
1 parent d9b30b8 commit 8786b70

14 files changed

+989
-1396
lines changed

apps/hapi/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
"dependencies": {
1818
"@hapi/hapi": "21.3.9",
19-
"@sentry/node": "7.113.0",
19+
"@sentry/node": "8.0.0-beta.6",
2020
"dotenv": "^16.4.5"
2121
}
2222
}

apps/hapi/src/app.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
const Sentry = require('@sentry/node');
2+
import dotenv from 'dotenv';
3+
4+
dotenv.config({ path: './../../.env' });
5+
6+
Sentry.init({
7+
environment: 'qa', // dynamic sampling bias to keep transactions
8+
dsn: process.env.SENTRY_DSN,
9+
includeLocalVariables: true,
10+
debug: true,
11+
tunnel: `http://localhost:3031/`, // proxy server
12+
tracesSampleRate: 1,
13+
});
14+
215
import Hapi from '@hapi/hapi';
316
import dotenv from 'dotenv';
417

@@ -15,16 +28,6 @@ declare global {
1528
}
1629
}
1730

18-
Sentry.init({
19-
environment: 'qa', // dynamic sampling bias to keep transactions
20-
dsn: process.env.SENTRY_DSN,
21-
includeLocalVariables: true,
22-
integrations: [Sentry.hapiIntegration({ server })],
23-
debug: true,
24-
tunnel: `http://localhost:3031/`, // proxy server
25-
tracesSampleRate: 1,
26-
});
27-
2831
const init = async () => {
2932
server.route({
3033
method: 'GET',

payload-files/hapi/_test-error--event.json

Lines changed: 61 additions & 32 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.113.0"
7+
"version": "8.0.0-beta.6"
88
},
99
"sent_at": "[[ISODateString]]",
1010
"trace": {
@@ -13,7 +13,7 @@
1313
"sample_rate": "1",
1414
"sampled": "true",
1515
"trace_id": "[[ID2]]",
16-
"transaction": "/test-error"
16+
"transaction": "GET /test-error"
1717
}
1818
},
1919
{
@@ -24,19 +24,13 @@
2424
{
2525
"category": "console",
2626
"level": "log",
27-
"message": "Server running on http://localhost:3030",
28-
"timestamp": "[[timestamp]]"
29-
},
30-
{
31-
"category": "console",
32-
"level": "log",
33-
"message": "test console",
27+
"message": "env https://3b6c388182fb435097f41d181be2b2ba@o4504321058471936.ingest.sentry.io/4504321066008576",
3428
"timestamp": "[[timestamp]]"
3529
},
3630
{
3731
"category": "console",
3832
"level": "log",
39-
"message": "test console",
33+
"message": "Server running on http://localhost:3030",
4034
"timestamp": "[[timestamp]]"
4135
}
4236
],
@@ -70,13 +64,6 @@
7064
"version": "v20.12.1"
7165
},
7266
"trace": {
73-
"data": {
74-
"sentry.op": "hapi.request",
75-
"sentry.origin": "manual",
76-
"sentry.sample_rate": 1
77-
},
78-
"op": "hapi.request",
79-
"origin": "manual",
8067
"span_id": "[[ID3]]",
8168
"trace_id": "[[ID2]]"
8269
}
@@ -179,7 +166,7 @@
179166
"filename": "[[FILENAME3]]",
180167
"function": "handler",
181168
"in_app": true,
182-
"lineno": 71,
169+
"lineno": 73,
183170
"module": "app",
184171
"post_context": [
185172
" var exceptionId;",
@@ -233,7 +220,7 @@
233220
"colno": 71,
234221
"context_line": " step((generator = generator.apply(thisArg, _arguments || [])).next());",
235222
"filename": "[[FILENAME3]]",
236-
"function": "<anonymous>",
223+
"function": "?",
237224
"in_app": true,
238225
"lineno": 8,
239226
"module": "app",
@@ -314,9 +301,9 @@
314301
"colno": 71,
315302
"context_line": " exceptionId = Sentry.captureException(new Error('This is an error'));",
316303
"filename": "[[FILENAME3]]",
317-
"function": "<anonymous>",
304+
"function": "?",
318305
"in_app": true,
319-
"lineno": 76,
306+
"lineno": 78,
320307
"module": "app",
321308
"post_context": [
322309
" return [4 /*yield*/, Sentry.flush(2000)];",
@@ -345,10 +332,42 @@
345332
]
346333
},
347334
"modules": {
348-
"localforage": "1.10.0",
349-
"mime-db": "1.52.0"
335+
"debug": "4.3.4",
336+
"dotenv": "16.4.5",
337+
"function-bind": "1.1.2",
338+
"hasown": "2.0.2",
339+
"import-in-the-middle": "1.7.1",
340+
"is-core-module": "2.13.1",
341+
"mime-db": "1.52.0",
342+
"module-details-from-path": "1.0.3",
343+
"opentelemetry-instrumentation-fetch-node": "1.2.0",
344+
"require-in-the-middle": "7.3.0",
345+
"resolve": "1.22.8",
346+
"semver": "7.6.0",
347+
"shimmer": "1.2.1",
348+
"supports-color": "5.5.0",
349+
"yallist": "4.0.0"
350350
},
351351
"platform": "node",
352+
"request": {
353+
"cookies": {},
354+
"headers": {
355+
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
356+
"accept-encoding": "gzip, deflate, br",
357+
"accept-language": "en-US,en;q=0.5",
358+
"connection": "keep-alive",
359+
"dnt": "1",
360+
"host": "localhost:3030",
361+
"sec-fetch-dest": "document",
362+
"sec-fetch-mode": "navigate",
363+
"sec-fetch-site": "none",
364+
"sec-fetch-user": "?1",
365+
"upgrade-insecure-requests": "1",
366+
"user-agent": "[[user-agent]]"
367+
},
368+
"method": "GET",
369+
"url": "http://localhost:3030/test-error"
370+
},
352371
"sdk": {
353372
"integrations": [
354373
"InboundFilters",
@@ -357,28 +376,38 @@
357376
"RequestData",
358377
"Console",
359378
"Http",
360-
"Undici",
379+
"NodeFetch",
361380
"OnUncaughtException",
362381
"OnUnhandledRejection",
363382
"ContextLines",
364-
"LocalVariables",
383+
"LocalVariablesAsync",
365384
"Context",
366385
"Modules",
367-
"Hapi"
386+
"Express",
387+
"Fastify",
388+
"Graphql",
389+
"Mongo",
390+
"Mongoose",
391+
"Mysql",
392+
"Mysql2",
393+
"Redis",
394+
"Postgres",
395+
"Nest",
396+
"Hapi",
397+
"Koa",
398+
"Connect"
368399
],
369400
"name": "sentry.javascript.node",
370401
"packages": [
371402
{
372403
"name": "npm:@sentry/node",
373-
"version": "7.113.0"
404+
"version": "8.0.0-beta.6"
374405
}
375406
],
376-
"version": "7.113.0"
407+
"version": "8.0.0-beta.6"
377408
},
378409
"server_name": "D9M3PY4LQ7.local",
379-
"tags": {
380-
"transaction": "/test-error"
381-
},
382-
"timestamp": "[[timestamp]]"
410+
"timestamp": "[[timestamp]]",
411+
"transaction": "GET /test-error"
383412
}
384413
]

0 commit comments

Comments
 (0)