Socket
Socket
Sign inDemoInstall

raven

Package Overview
Dependencies
Maintainers
10
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

raven - npm Package Compare versions

Comparing version 2.2.1 to 2.3.0

13

History.md

@@ -0,1 +1,12 @@

# 2.3.0 - 12/11/2017
- fix: attach remaining non-enumerables to req [See #387]
- feat: Allow to configure stacktrace for captureMessage calls [See #388]
- fix: access 'process' through global variable [See #399]
- ref: Enable http instrumentation by default [See #401]
- ref: Warn user when using capture/wrap without installing Raven [See #402]
- ci: Integrate Zeus and release with the bot [See #403]
- ref: Delete empty properties before sending event to the server [See #407]
- feat: Support Boom library statusCode [See #408]
# 2.2.1 - 10/02/2017

@@ -13,3 +24,3 @@

- Preserve some non-enumerable properties from request [See #379]
- Fall back to NODE_ENV for Sentry Environment [See #384]
- Fall back to `NODE_ENV` for Sentry Environment [See #384]

@@ -16,0 +27,0 @@ # 2.1.2 - 8/16/2017

101

lib/client.js

@@ -40,3 +40,3 @@ 'use strict';

// no arguments, use default from environment
dsn = process.env.SENTRY_DSN;
dsn = global.process.env.SENTRY_DSN;
options = {};

@@ -47,3 +47,3 @@ }

options = dsn;
dsn = process.env.SENTRY_DSN;
dsn = global.process.env.SENTRY_DSN;
}

@@ -54,9 +54,12 @@ options = options || {};

this.dsn = utils.parseDSN(dsn);
this.name = options.name || process.env.SENTRY_NAME || require('os').hostname();
this.root = options.root || process.cwd();
this.name =
options.name || global.process.env.SENTRY_NAME || require('os').hostname();
this.root = options.root || global.process.cwd();
this.transport = options.transport || transports[this.dsn.protocol];
this.sendTimeout = options.sendTimeout || 1;
this.release = options.release || process.env.SENTRY_RELEASE || '';
this.release = options.release || global.process.env.SENTRY_RELEASE;
this.environment =
options.environment || process.env.SENTRY_ENVIRONMENT || process.env.NODE_ENV || '';
options.environment ||
global.process.env.SENTRY_ENVIRONMENT ||
global.process.env.NODE_ENV;

@@ -70,3 +73,3 @@ // autoBreadcrumbs: true enables all, autoBreadcrumbs: false disables all

this.captureUnhandledRejections = options.captureUnhandledRejections;
this.loggerName = options.logger || '';
this.loggerName = options.logger;
this.dataCallback = options.dataCallback;

@@ -77,2 +80,3 @@ this.shouldSendCallback = options.shouldSendCallback;

this.parseUser = options.parseUser;
this.stacktrace = options.stacktrace || false;

@@ -101,3 +105,3 @@ if (!this.dsn) {

console.error(err && err.stack ? err.stack : err);
process.exit(1);
global.process.exit(1);
};

@@ -120,7 +124,7 @@ this.uncaughtErrorHandler = this.makeErrorHandler();

process.on('uncaughtException', this.uncaughtErrorHandler);
global.process.on('uncaughtException', this.uncaughtErrorHandler);
if (this.captureUnhandledRejections) {
var self = this;
process.on('unhandledRejection', function(reason) {
global.process.on('unhandledRejection', function(reason) {
self.captureException(reason, function(sendErr, eventId) {

@@ -145,4 +149,4 @@ if (!sendErr) utils.consoleAlert('unhandledRejection captured: ' + eventId);

// todo: this works for tests for now, but isn't what we ultimately want to be doing
process.removeAllListeners('uncaughtException');
process.removeAllListeners('unhandledRejection');
global.process.removeAllListeners('uncaughtException');
global.process.removeAllListeners('unhandledRejection');

@@ -240,3 +244,3 @@ this.installed = false;

parseUser returns a partial kwargs object with a `request` property and possibly a `user` property
*/
*/
kwargs.request = this._createRequestObject(

@@ -263,4 +267,4 @@ this._globalContext.request,

if (typeof process.version !== 'undefined') {
kwargs.extra.node = process.version;
if (typeof global.process.version !== 'undefined') {
kwargs.extra.node = global.process.version;
}

@@ -274,7 +278,10 @@

kwargs.platform = 'node';
kwargs.release = this.release;
// Only include release information if it is set
if (this.release) {
kwargs.release = this.release;
}
// Cleanup empty properties before sending them to the server
Object.keys(kwargs).forEach(function(key) {
if (kwargs[key] == null || kwargs[key] === '') {
delete kwargs[key];
}
});

@@ -332,5 +339,28 @@ if (this.dataCallback) {

}
var eventId = this.generateEventId();
this.process(eventId, parsers.parseText(message, kwargs), cb);
if (this.stacktrace) {
var ex;
// Generate a "synthetic" stack trace
try {
throw new Error(message);
} catch (ex1) {
ex = ex1;
}
utils.parseStack(
ex,
function(frames) {
// We trim last frame, as it's our `throw new Error(message)` call itself, which is redundant
kwargs.stacktrace = {
frames: frames.slice(0, -1)
};
this.process(eventId, parsers.parseText(message, kwargs), cb);
}.bind(this)
);
} else {
this.process(eventId, parsers.parseText(message, kwargs), cb);
}
return eventId;

@@ -376,2 +406,7 @@ },

wrap: function(options, func) {
if (!this.installed) {
utils.consoleAlertOnce(
'Raven has not been installed, therefore no breadcrumbs will be captured. Call `Raven.config(...).install()` to fix this.'
);
}
if (!func && typeof options === 'function') {

@@ -505,3 +540,8 @@ func = options;

return function(err, req, res, next) {
var status = err.status || err.statusCode || err.status_code || 500;
var status =
err.status ||
err.statusCode ||
err.status_code ||
(err.output && err.output.statusCode) ||
500;

@@ -543,8 +583,10 @@ // skip anything not marked as an internal server error

*
* Same scenario happens when some frameworks (eg. Koa) decide to use request within
* request. eg `this.request.req`, which adds aliases to the main `request` object.
* By manually reassigning them here, we don't need to add additional checks
* like `req.method || (req.req && req.req.method)`
*
* We don't use Object.assign/extend as it's only merging over objects own properties,
* and we don't want to go through all of the properties as well, as we simply don't
* need all of them.
*
* So far the only missing piece is `ip`, but we can specify what properties should
* be pulled by extending `nonEnumerables` array.
**/

@@ -556,3 +598,12 @@ var sources = Array.from(arguments).filter(function(source) {

var request = extend.apply(null, sources);
var nonEnumberables = ['ip'];
var nonEnumberables = [
'headers',
'host',
'ip',
'method',
'protocol',
'query',
'secure',
'url'
];

@@ -559,0 +610,0 @@ nonEnumberables.forEach(function(key) {

@@ -6,3 +6,4 @@ 'use strict';

var defaultOnConfig = {
console: true
console: true,
http: true
};

@@ -9,0 +10,0 @@

@@ -135,3 +135,3 @@ 'use strict';

((require.main && require.main.filename && path.dirname(require.main.filename)) ||
process.cwd()) + '/';
global.process.cwd()) + '/';

@@ -138,0 +138,0 @@ function getModule(filename, base) {

@@ -12,3 +12,3 @@ {

],
"version": "2.2.1",
"version": "2.3.0",
"repository": "git://github.com/getsentry/raven-node.git",

@@ -15,0 +15,0 @@ "license": "BSD-2-Clause",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc