Skip to content

Commit 263f209

Browse files
SimonSchickkamilogorek
authored andcommitted
chore(node): use native md5
1 parent 26f5416 commit 263f209

File tree

5 files changed

+2728
-960
lines changed

5 files changed

+2728
-960
lines changed

packages/browser/src/md5.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ function str2rstrUTF8(input: string) {
237237
}
238238

239239
/*
240-
* Take string arguments and return either raw or hex encoded strings
241-
*/
240+
* Take string arguments and return either raw or hex encoded strings
241+
*/
242242
function rawMD5(s: string) {
243243
return rstrMD5(str2rstrUTF8(s));
244244
}

packages/browser/src/tracekit.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -502,11 +502,14 @@ TraceKit.report = (function reportModuleWrapper() {
502502
// slow slow IE to see if onerror occurs or not before reporting
503503
// this exception; otherwise, we will end up with an incomplete
504504
// stack trace
505-
setTimeout(function() {
506-
if (lastException === ex) {
507-
processLastException();
508-
}
509-
}, stack.incomplete ? 2000 : 0);
505+
setTimeout(
506+
function() {
507+
if (lastException === ex) {
508+
processLastException();
509+
}
510+
},
511+
stack.incomplete ? 2000 : 0,
512+
);
510513

511514
throw ex; // re-throw to propagate to the top level (and cause window.onerror)
512515
}

packages/node/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@
2222
"@types/stack-trace": "0.0.29",
2323
"cookie": "0.3.1",
2424
"lsmod": "1.0.0",
25-
"md5": "2.2.1",
2625
"stack-trace": "0.0.10",
2726
"tslib": "^1.9.3"
2827
},
2928
"devDependencies": {
3029
"@types/cookie": "0.3.1",
31-
"@types/md5": "2.1.32",
30+
"@types/node": "^10.12.10",
3231
"express": "^4.16.4",
3332
"jest": "^22.4.3",
3433
"npm-run-all": "^4.1.2",

packages/node/src/backend.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { BaseBackend, Dsn, getCurrentHub, Options, SentryError } from '@sentry/c
22
import { SentryEvent, SentryEventHint, SentryResponse, Severity } from '@sentry/types';
33
import { isError, isPlainObject } from '@sentry/utils/is';
44
import { limitObjectDepthToSize, serializeKeysToEventMessage } from '@sentry/utils/object';
5-
import * as md5 from 'md5';
5+
import { createHash } from 'crypto';
66
import { extractStackFromError, parseError, parseStack, prepareFramesForEvent } from './parsers';
77
import { HTTPSTransport, HTTPTransport } from './transports';
88

@@ -38,7 +38,11 @@ export class NodeBackend extends BaseBackend<NodeOptions> {
3838

3939
getCurrentHub().configureScope(scope => {
4040
scope.setExtra('__serialized__', limitObjectDepthToSize(exception as {}));
41-
scope.setFingerprint([md5(keys.join(''))]);
41+
scope.setFingerprint([
42+
createHash('md5')
43+
.update(keys.join(''))
44+
.digest('hex'),
45+
]);
4246
});
4347

4448
ex = (hint && hint.syntheticException) || new Error(message);
@@ -100,8 +104,8 @@ export class NodeBackend extends BaseBackend<NodeOptions> {
100104
this.transport = this.options.transport
101105
? new this.options.transport({ dsn })
102106
: dsn.protocol === 'http'
103-
? new HTTPTransport(transportOptions)
104-
: new HTTPSTransport(transportOptions);
107+
? new HTTPTransport(transportOptions)
108+
: new HTTPSTransport(transportOptions);
105109
}
106110

107111
return this.transport.captureEvent(event);

0 commit comments

Comments
 (0)