Comparing version 2.1.1 to 3.0.0-beta
{ | ||
"author": "Airbrake Technologies, Inc.", | ||
"contributors": [ | ||
"Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)", | ||
"László Bácsi <lackac@lackac.hu> (http://lackac.hu)", | ||
"Carlos Brito Lage <carlos@carloslage.net> (http://carloslage.net)", | ||
"Stephen Celis <me@stephencelis.com> (http://stephencelis.com)", | ||
"Sascha Depold <sascha@depold.com> (http://depold.com)", | ||
"Jon Keating <jon@licq.org> (http://www.thejon.org)", | ||
"Gabriel Lesperance <gabriel@wavo.me> (http://blog.wavo.me)", | ||
"Mathias Pettersson <mape@mape.me> (https://github.com/mape)", | ||
"Gary Rafferty <gary.rafferty@gmail.com> (http://www.garyrafferty.com)", | ||
"Rob Scott <rob.scott87@gmail.com> (http://lifekraze.com/rob)", | ||
"Dylan Smith <Dylan.Smith@shopify.com> (https://github.com/dylanahsmith)", | ||
"stefounet <s@fasterize.com> (http://fasterize.com)", | ||
"sreuter <s.reuter@geek-it.de> (https://github.com/sreuterairbrake.io", | ||
"Johnny Halife <johnny.halife@me.com> (http://johnny.io)" | ||
], | ||
"name": "airbrake", | ||
"description": "DEPRECATION: please use airbrake-js instead (https://github.com/airbrake/airbrake-js). A Node.js notifier for Airbrake, the leading exception reporting service.", | ||
"version": "2.1.1", | ||
"homepage": "https://github.com/airbrake/node-airbrake", | ||
"version": "3.0.0-beta", | ||
"description": "Notify Airbrake on JavaScript exceptions", | ||
"author": "Airbrake", | ||
"license": "MIT", | ||
"repository": { | ||
@@ -27,30 +11,22 @@ "type": "git", | ||
}, | ||
"main": "./index", | ||
"engines": { | ||
"node": "*" | ||
"keywords": [ | ||
"exception", | ||
"error", | ||
"airbrake", | ||
"notifier" | ||
], | ||
"devDependencies": { | ||
"rollup-plugin-typescript2": "^0.22.1", | ||
"typescript": "^3.5.3" | ||
}, | ||
"main": "dist/airbrake.common.js", | ||
"files": [ | ||
"dist/", | ||
"README.md", | ||
"LICENSE" | ||
], | ||
"scripts": { | ||
"lint": "eslint .", | ||
"test": "test/run.js", | ||
"posttest": "npm run lint" | ||
}, | ||
"dependencies": { | ||
"lodash.merge": "^4.6.0", | ||
"request": "^2.81.0", | ||
"stack-trace": "^0.0.9" | ||
}, | ||
"devDependencies": { | ||
"eslint": "~2.8.0", | ||
"eslint-config-airbnb-base": "~1.0.3", | ||
"eslint-plugin-import": "~1.6.1", | ||
"express": "~4.13.4", | ||
"far": "~0.0.4", | ||
"hapi": "~13.5.0", | ||
"mockery": "~1.4.0", | ||
"nock": "^8.0.0", | ||
"semver": "~5.3.0", | ||
"sinon": "~1.7.2" | ||
}, | ||
"optionalDependencies": {}, | ||
"license": "MIT" | ||
"build": "rollup --config", | ||
"test": "jest" | ||
} | ||
} |
400
README.md
@@ -1,63 +0,20 @@ | ||
Node Airbrake | ||
============= | ||
# Airbrake for Node.js | ||
[![Circle CI](https://circleci.com/gh/airbrake/node-airbrake.svg?style=shield)](https://circleci.com/gh/airbrake/node-airbrake) | ||
[![npm version](https://badge.fury.io/js/airbrake.svg)](https://badge.fury.io/js/airbrake) | ||
[![Documentation Status](http://inch-ci.org/github/airbrake/node-airbrake.svg?branch=master)](http://inch-ci.org/github/airbrake/node-airbrake) | ||
[![Downloads](https://img.shields.io/npm/dt/airbrake.svg)](https://www.npmjs.com/package/airbrake) | ||
[![Build Status](https://travis-ci.org/airbrake/airbrake-js.svg?branch=master)](https://travis-ci.org/airbrake/airbrake-js) | ||
**DEPRECATION WARNING: Node Airbrake is deprecated in favour of Airbrake JS | ||
(https://github.com/airbrake/airbrake-js). Please migrate to it as soon as | ||
possible.** | ||
This is the JavaScript notifier for capturing errors in Node.js and reporting them to [Airbrake](http://airbrake.io). For web browsers there is a [separate package](https://github.com/airbrake/airbrake-js/tree/master/packages/airbrake-js). | ||
![Node Airbrake][arthur-node] | ||
<img src="http://f.cl.ly/items/443E2J1D2W3x1E1u3j1u/JS-airbrakeman.jpg" width=800px> | ||
* [Node Airbrake README][node-airbrake] | ||
## Installation | ||
Introduction | ||
------------ | ||
airbrake can be installed using yarn: | ||
**DEPRECATION WARNING: Node Airbrake is deprecated in favour of Airbrake JS | ||
(https://github.com/airbrake/airbrake-js). Please migrate to it as soon as | ||
possible.** | ||
_Node Airbrake_ is a Node.js notifier for [Airbrake][airbrake-io], the leading | ||
exception reporting service. The library provides minimalist API that enables | ||
the ability to send _any_ Node exception to the Airbrake dashboard. Node | ||
Airbrake provides out-of-box integration with the Express web framework. | ||
Key features | ||
------------ | ||
![The Airbrake Dashboard][dashboard] | ||
* Send chosen environment variables (whitelist or blacklist) | ||
* Detect and fix circular references in error context information | ||
* Support for all features of the [2.1 notification API][2.1api] | ||
* Support for [long-stack-traces][] | ||
* Optional auto-handler for `uncaughtException` events | ||
* Provides notification URL linking to Airbrake in `notify()` callback | ||
* Timeout Airbrake requests after 30 seconds, you never know | ||
* Express web application framework support | ||
* hapi web application framework support | ||
Installation | ||
------------ | ||
### NPM | ||
Add the Node Airbrake package to your `package.json`: | ||
```js | ||
{ | ||
"dependencies": { | ||
"airbrake": "^2.1.1" | ||
} | ||
} | ||
```sh | ||
yarn add airbrake | ||
``` | ||
### Manual | ||
or using npm: | ||
Invoke the following command from your terminal: | ||
```sh | ||
@@ -67,339 +24,48 @@ npm install airbrake | ||
Examples | ||
-------- | ||
Example configurations can be found in [examples](examples), including: | ||
### Basic example | ||
* [Express](examples/express) | ||
* [Node.js](examples/nodejs) | ||
This is the minimal example that you can use to test Node Airbrake with your | ||
project. The common use case for this module is to catch all `'uncaughtException'` | ||
events on the `process` object and send them to Airbrake: | ||
### Node.js request and proxy | ||
```js | ||
var airbrake = require('airbrake').createClient( | ||
'105138', // Project ID | ||
'fd04e13d806a90f96614ad8e529b2822' // Project key | ||
); | ||
airbrake.handleExceptions(); | ||
In order to configure [request](https://github.com/request/request) HTTP client you can pass `request` option which accepts request wrapper: | ||
throw new Error('I am an uncaught exception'); | ||
``` | ||
Note: the above will re-throw the exception after it has been successfully | ||
delivered to Airbrake, causing your process to exit with status 1. | ||
This can optionally be disabled by passing false to `handleExceptions` (not | ||
recommended): | ||
```js | ||
airbrake.handleExceptions(false); | ||
``` | ||
### Filtering errors | ||
There may be some errors thrown in your application that you're not interested in sending to Airbrake, such as errors thrown by 3rd-party libraries. | ||
The Airbrake notifier makes it simple to ignore this chaff while still processing legitimate errors. Add filters to the notifier by providing filter functions to `addFilter`. | ||
`addFilter` accepts the entire [error notice](https://airbrake.io/docs/#create-notice-v3) to be sent to Airbrake, and provides access to the `context`, `environment`, `params`, and `session` values submitted with the notice, as well as the single-element `errors` array with its `backtrace` element and associated backtrace lines. | ||
The return value of the filter function determines whether or not the error notice will be submitted. | ||
* If null value is returned, the notice is ignored. | ||
* Otherwise returned notice will be submitted. | ||
An error notice must pass all provided filters to be submitted. | ||
In the following example errors triggered with a message of 'this should not be posted to airbrake' will be ignored: | ||
```js | ||
airbrake.addFilter(function(notice) { | ||
if (notice.errors[0].message === 'this should not be posted to airbrake') { | ||
// Ignore errors with this messsage | ||
return null; | ||
} | ||
return notice; | ||
var airbrake = new AirbrakeClient({ | ||
... | ||
request: request.defaults({'proxy':'http://localproxy.com'}) | ||
}); | ||
``` | ||
Filters can be also used to modify notice payload, e.g. to set environment and application version: | ||
## Contributing | ||
```js | ||
airbrake.addFilter(function(notice) { | ||
notice.context.environment = 'production'; | ||
notice.context.version = '1.2.3'; | ||
return notice; | ||
}); | ||
``` | ||
Install dependencies: | ||
### Manual error delivery | ||
If you want more control over the delivery of your errors, you can also | ||
manually submit errors to Airbrake: | ||
```js | ||
var airbrake = require('airbrake').createClient("your project ID", "your api key"); | ||
var err = new Error('Something went terribly wrong'); | ||
airbrake.notify(err, function(err, url) { | ||
if (err) throw err; | ||
// Error has been delivered, url links to the error in airbrake | ||
}); | ||
```bash | ||
yarn install | ||
``` | ||
### Severity | ||
Run unit tests: | ||
[Severity](https://airbrake.io/docs/airbrake-faq/what-is-severity/) allows | ||
categorizing how severe an error is. By default, it's set to `error`. To | ||
redefine severity, simply set an error's `severity` property. For example: | ||
```js | ||
var err = new Error(); | ||
err.severity = 'critical'; | ||
airbrake.notify(err); | ||
```bash | ||
yarn test | ||
``` | ||
### Express integration | ||
Build project: | ||
The library provides out-of-box integration with the Express framework. It | ||
supports even old Express versions (starting from `2.x`). Select your version | ||
below and configure accordingly. | ||
#### Express 4.x | ||
```js | ||
var airbrake = require('airbrake').createClient("your project ID", "your api key"); | ||
app.use(airbrake.expressHandler()); | ||
```bash | ||
yarn build | ||
``` | ||
#### Express 3.x | ||
## Credits | ||
```js | ||
var airbrake = require('airbrake').createClient("your project ID", "your api key"); | ||
app.use(app.router); | ||
app.use(airbrake.expressHandler()); | ||
``` | ||
Airbrake is maintained and funded by [airbrake.io](http://airbrake.io) | ||
#### Express 2.x | ||
Thank you to all [the contributors](https://github.com/airbrake/airbrake-js/contributors). | ||
```js | ||
var airbrake = require('airbrake').createClient("your project ID", "your api key"); | ||
app.error(airbrake.expressHandler()); | ||
``` | ||
The names and logos for Airbrake are trademarks of Airbrake Technologies Inc. | ||
### hapi integration | ||
# License | ||
The library provides out-of-box integration with the hapi framework. To | ||
integrate Airbrake with a hapi application simply install our handler: | ||
```js | ||
const Hapi = require('hapi'); | ||
const server = new Hapi.Server(); | ||
const Airbrake = require('airbrake').createClient( | ||
"your project ID", | ||
"your api key" | ||
); | ||
Airbrake.env = 'production'; | ||
server.register(Airbrake.hapiHandler(), err => { | ||
if (err) { | ||
throw err; | ||
} | ||
}); | ||
``` | ||
API | ||
--- | ||
## Adding context to errors | ||
The `notify()` method automatically adds the following context information to | ||
each delivered error: | ||
* **error.class:** (`err.type` string if set, or `'Error'`) | ||
* **error.message:** (`err.message` string) | ||
* **error.backtrace:** (`err.stack` as parsed by [stack-trace][]) | ||
* **error.severity:** (`err.severity` defaults to `error`) | ||
* **request.url:** (`err.url`, see `airbrake.url`); | ||
* **request.component:** (`err.component` string if set); | ||
* **request.action:** (`err.action` string if set); | ||
* **request.cgi-data:** (`process.env`, merged all other properties of `err`) | ||
* **request.params:** (`err.params` object if set) | ||
* **request.session:** (`err.session` object if set) | ||
* **server-environment.project-root:** (`airbrake.projectRoot` string if set) | ||
* **server-environment.environment-name:** (`airbrake.env` string) | ||
* **server-environment.app-version:** (`airbrake.appVersion string if set) | ||
You can add additional context information by modifying the error properties | ||
listed above: | ||
``` javascript | ||
var airbrake = require('airbrake').createClient("your project ID", "your api key"); | ||
var http = require('http'); | ||
http.createServer(function(req, res) { | ||
if (req.headers['X-Secret'] !== 'my secret') { | ||
var err = new Error('403 - Permission denied'); | ||
req.writeHead(403); | ||
req.end(err.message); | ||
err.url = req.url; | ||
err.params = {ip: req.socket.remoteAddress}; | ||
airbrake.notify(err); | ||
} | ||
}); | ||
``` | ||
Unfortunately `uncaughtException` events cannot be traced back to particular | ||
requests, so you should still try to handle errors where they occur. | ||
[stack-trace]: https://github.com/felixge/node-stack-trace | ||
## Tracking deployments | ||
This client supports Airbrake's [deployment tracking][]: | ||
``` javascript | ||
var airbrake = require('airbrake').createClient("your project ID", "your api key"); | ||
var deployment = { | ||
rev: '98103a8fa850d5eaf3666e419d8a0a93e535b1b2', | ||
repo: 'git@github.com:felixge/node-airbrake.git', | ||
}; | ||
airbrake.trackDeployment(deployment, function(err, params) { | ||
if (err) { | ||
throw err; | ||
} | ||
console.log('Tracked deployment of %s to %s', params.rev, params.env); | ||
}); | ||
``` | ||
Check out the `airbrake.trackDeployment()` API docs below for a list of all | ||
options. | ||
Configuration | ||
------------- | ||
### var airbrake = Airbrake.createClient(projectId, key, [env]) | ||
`Airbrake.createClient()` returns a new Airbrake instance. | ||
Options | ||
* `projectId` - Your application's Airbrake project ID. | ||
* `key` - Your application's Airbrake API key. | ||
* `env` - The name of the server environment this is running in. | ||
### airbrake.projectId = null | ||
Your application's Airbrake project ID. | ||
### airbrake.key = null | ||
Your application's Airbrake API key. | ||
### airbrake.env = process.env.NODE_ENV || 'development' | ||
The name of the server environment this is running in. | ||
### airbrake.host = 'https://' + os.hostname() | ||
The base url for errors. If `err.url` is not set, `airbrake.host` is used | ||
instead. If `err.url` is a relative url starting with `'/'`, it is appended | ||
to `airbrake.host`. If `err.url` is an absolute url, `airbrake.host` is ignored. | ||
### airbrake.projectRoot = process.cwd() | ||
The root directory of this project. | ||
### airbrake.appVersion = null | ||
The version of this app. Set to a semantic version number, or leave unset. | ||
### airbrake.protocol = 'https' | ||
The protocol to use. | ||
### airbrake.timeout = 30 * 1000 | ||
The timeout after which to give up trying to notify Airbrake in ms. | ||
### airbrake.proxy = null | ||
The HTTP/HTTPS proxy to use when making requests. | ||
### airbrake.requestOptions = {} | ||
Additional request options that are merged with the default set of options that are passed to `request` during `notify()` and `trackDeployment()`. | ||
### airbrake.whiteListKeys = [] | ||
Names of environment variables to send. | ||
### airbrake.blackListKeys = [] | ||
Names of environment variables to filter out. | ||
### airbrake.handleExceptions() | ||
Registers a `process.on('uncaughtException')` listener. When an uncaught | ||
exception occurs, the error is sent to Airbrake, and then re-thrown to | ||
kill the process. | ||
### airbrake.handlePromiseRejections() | ||
Registers a `process.on('unhandledRejection')` listener. When an uncaught | ||
exception occurs inside a promise, the error is sent to Airbrake, and then re-thrown to | ||
kill the process. | ||
### airbrake.expressHandler(disableUncaughtException) | ||
A custom error handler that is used with Express. Integrate with Express | ||
middleware using `app.use()`. | ||
Options: | ||
* `disableUncaughtException`: Disables re-throwing and killing process on uncaught exception. | ||
### airbrake.notify(err, [cb]) | ||
Sends the given `err` to airbrake. | ||
The callback parameter receives two arguments, `err, url`. `err` is set if | ||
the delivery to Airbrake failed. | ||
If no `cb` is given, and the delivery fails, an `error` event is emitted. If | ||
there is no listener for this event, node will kill the process as well. This | ||
is done to avoid silent error delivery failure. | ||
### airbrake.trackDeployment([params, [cb]]) | ||
Notifies Airbrake about a deployment. `params` is an object with the following | ||
options: | ||
* `env:` The environment being deployed, defaults to `airbrake.env`. | ||
* `user:` The user doing the deployment, defaults to `process.env.USER`. | ||
* `repo:` The github url of this repository. Defaults to `git config --get remote.origin.url`. | ||
* `rev:` The revision of this deployment. Defaults to `git rev-parse HEAD`. | ||
Additional notes | ||
---------------- | ||
### Exception limit | ||
The maximum size of an exception is 64KB. Exceptions that exceed this limit will | ||
be truncated to fit the size. | ||
License | ||
------- | ||
The library was originally created by [Felix Geisendörfer](https://github.com/felixge). | ||
The project uses the MIT License. See LICENSE.md for details. | ||
[arthur-node]: http://s3.amazonaws.com/airbrake-github-assets/node-airbrake/arthur-node.jpeg | ||
[node-airbrake]: https://github.com/airbrake/node-airbrake | ||
[airbrake-io]: https://airbrake.io | ||
[long-stack-traces]: https://github.com/tlrobinson/long-stack-traces | ||
[2.1api]: http://help.airbrake.io/kb/api-2/notifier-api-version-21 | ||
[screenshot]: https://github.com/airbrake/node-airbrake/raw/master/screenshot.png | ||
[deployment tracking]: https://airbrake.io/docs/airbrake-faq/deploy-tracking/ | ||
[dashboard]: http://s3.amazonaws.com/airbrake-github-assets/node-airbrake/airbrake-dashboard.png | ||
Airbrake is Copyright © 2008-2017 Airbrake Technologies Inc. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
88346
0
2
2
3
7
1
913
2
71
- Removedlodash.merge@^4.6.0
- Removedrequest@^2.81.0
- Removedstack-trace@^0.0.9
- Removedajv@6.12.6(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedlodash.merge@4.6.2(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpsl@1.9.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedstack-trace@0.0.9(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)