Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bugsnag

Package Overview
Dependencies
Maintainers
4
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bugsnag - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

4

CHANGELOG.md
Changelog
=========
1.5.0
-----
- Allow use of a proxy when communicating with bugsnag
1.4.0

@@ -5,0 +9,0 @@ -----

@@ -26,2 +26,4 @@ var Configuration, Logger, Utils, path;

Configuration.proxy = null;
Configuration.notifyHost = "notify.bugsnag.com";

@@ -77,2 +79,3 @@

Configuration.hostname = options.hostname || Configuration.hostname;
Configuration.proxy = options.proxy;
if (options.projectRoot != null) {

@@ -79,0 +82,0 @@ Configuration.projectRoot = Utils.fullPath(options.projectRoot);

48

lib/notification.js

@@ -1,2 +0,2 @@

var Configuration, Logger, Notification, Utils, path, requestInfo,
var Configuration, Logger, Notification, Utils, path, request, requestInfo,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

@@ -14,2 +14,4 @@

request = require("request");
module.exports = Notification = (function() {

@@ -95,3 +97,3 @@ var NOTIFIER_NAME, NOTIFIER_URL, NOTIFIER_VERSION, SUPPORTED_SEVERITIES;

Notification.prototype.deliver = function(cb) {
var cache, lib, options, payload, port, req;
var cache, notifyUrl, options, payload, port;
if (Utils.typeOf(cb) !== "function") {

@@ -113,7 +115,6 @@ cb = null;

});
notifyUrl = "" + (Configuration.useSSL ? "https" : "http") + "://" + Configuration.notifyHost + ":" + port + Configuration.notifyPath;
options = {
host: Configuration.notifyHost,
port: port,
path: Configuration.notifyPath,
method: 'POST',
proxy: Configuration.proxy,
body: payload,
headers: {

@@ -125,30 +126,19 @@ "Content-Type": 'application/json',

Configuration.logger.info(payload);
lib = Configuration.useSSL ? require("https") : require("http");
req = lib.request(options, function(res) {
var bodyRes;
if (cb) {
bodyRes = "";
res.setEncoding('utf8');
return res.on('data', function(chunk) {
if (chunk) {
return bodyRes += chunk;
}
}).on('end', function() {
return request.post(notifyUrl, options, function(err, res, body) {
if (err) {
if (cb) {
return cb(err);
} else {
return Configuration.logger.error(err);
}
} else {
if (cb) {
if (res.statusCode === 200) {
return cb(null, bodyRes);
return cb(null, body);
} else {
return cb(new Error(bodyRes));
return cb(new Error(body));
}
});
}
}
});
req.on("error", function(err) {
if (cb) {
return cb(err);
} else {
return Configuration.logger.error(err);
}
});
req.write(payload, "utf-8");
return req.end();
};

@@ -155,0 +145,0 @@

@@ -17,9 +17,9 @@ var requestInfo;

};
if (req.params && Object.keys(req.params).length > 0) {
if (req.params && typeof req.params === 'object' && Object.keys(req.params).length > 0) {
request.params = req.params;
}
if (req.query && Object.keys(req.query).length > 0) {
if (req.query && typeof req.params === 'object' && Object.keys(req.query).length > 0) {
request.query = req.query;
}
if (req.body && Object.keys(req.body).length > 0) {
if (req.body && typeof req.params === 'object' && Object.keys(req.body).length > 0) {
request.body = req.body;

@@ -26,0 +26,0 @@ }

{
"name": "bugsnag",
"description": "Bugsnag notifier for node.js scripts",
"version": "1.4.0",
"version": "1.5.0",
"main": "./lib/bugsnag.js",
"homepage": "http://bugsnag.com",
"dependencies": {
"stack-trace": ">=0.0.6"
"stack-trace": ">=0.0.6",
"request": ">=2.36.0"
},
"devDependencies": {
"mocha": "~1.8.0",
"mocha": "latest",
"chai": "~1.5.0",

@@ -16,5 +17,5 @@ "coffee-script": "latest",

"grunt": "~0.4.0",
"grunt-contrib-coffee": "~0.4.0",
"grunt-contrib-coffee": "latest",
"grunt-mocha-test": "latest",
"grunt-bumpx": "~0.1.0",
"grunt-bumpx": "latest",
"express": "~3.4.2"

@@ -21,0 +22,0 @@ },

@@ -224,3 +224,3 @@ Bugsnag Notifier for Node.js

```javascript
bugsnag.register("your-api-key-here", { onUncaughtError: function(error){
bugsnag.register("your-api-key-here", { onUncaughtError: function(err){
console.error(err.stack || err);

@@ -248,2 +248,21 @@ }});

### proxy
You can use a proxy server by configuring a proxy url when registering with bugsnag.
```javascript
bugsnag.register("your-api-key-here", { proxy: "http://localhost:8080" });
```
### filters
You can prevent some meta-data keys (such as passwords) from being sent to Bugsnag by listing
them in the filters. This is most useful if you're sending request data and don't want to
accidentally log a user's password. The keys are matched with substring matching, so the default
value of `["password"]` also excludes things like `"password_confirmation"`.
```javascript
bugsnag.register("your-api-key-here", { filters: ["password", "creditcard"] }
```
Notify

@@ -250,0 +269,0 @@ ------

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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