
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@airbrake/node
Advanced tools
This is the JavaScript notifier for capturing errors in Node.js and reporting them to Airbrake. For web browsers there is a separate package.
airbrake can be installed using yarn:
yarn add @airbrake/node
or using npm:
npm install @airbrake/node
Example configurations can be found in examples, including:
First you need to initialize the notifier with the project id and API key taken from Airbrake.io:
import { Notifier } from '@airbrake/browser';
const airbrake = new Notifier({
projectId: 1,
projectKey: 'REPLACE_ME',
environment: 'production',
});
Then you can send a textual message to Airbrake:
let promise = airbrake.notify(`user id=${user_id} not found`);
promise.then(function(notice) {
if (notice.id) {
console.log('notice id', notice.id);
} else {
console.log('notify failed', notice.error);
}
});
Or report catched errors directly:
try {
// This will throw if the document has no head tag
document.head.insertBefore(document.createElement('style'));
} catch(err) {
airbrake.notify(err);
throw err;
}
Alternatively, you can wrap any code which may throw errors using the client's wrap
method:
let startApp = function() {
// This will throw if the document has no head tag.
document.head.insertBefore(document.createElement('style'));
}
startApp = airbrake.wrap(startApp);
// Any exceptions thrown in startApp will be reported to Airbrake.
startApp();
or use call
shortcut:
let startApp = function() {
// This will throw if the document has no head tag.
document.head.insertBefore(document.createElement('style'));
}
airbrake.call(startApp);
In order to configure request HTTP client you can pass request
option which accepts request wrapper:
const airbrake = new Airbrake.Notifier({
...
request: request.defaults({'proxy':'http://localproxy.com'})
});
Install dependencies:
yarn install
Run unit tests:
yarn test
Build project:
yarn build
Airbrake is maintained and funded by airbrake.io
Thank you to all the contributors.
The names and logos for Airbrake are trademarks of Airbrake Technologies Inc.
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.
FAQs
Official Airbrake notifier for Node.js
The npm package @airbrake/node receives a total of 12,602 weekly downloads. As such, @airbrake/node popularity was classified as popular.
We found that @airbrake/node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.