Skip to content

Releases: GoodwayGroup/lib-hapi-rollbar

v0.6.3

08 Jan 20:00
Compare
Choose a tag to compare

Changelog

  • 4c581e1 chore(release): v0.6.3
  • 9c9dd87 chore(deps): update dependency jest to v27 (#79)
  • 8382c01 chore(deps): update all non-major dependencies (#78)
  • 25b5702 Chore: Upgrades dependencies to remove Critical and High vulnerabilities (#104)

v0.6.2

13 May 15:32
Compare
Choose a tag to compare

Changelog

a3a3203 fix: remove force push
d4190d9 chore(release): v0.6.2
3d7953d chore(deps): update dependency lodash to 4.17.21 [security] (#76)
088a294 chore(deps): update dependency husky to v6 (#72)
1f7ebde chore(deps): update dependency husky to v5.2.0 (#70)
4c08797 chore(deps): update dependency hosted-git-info to 2.8.9 [security] (#77)
c343bfd chore(deps): update dependency eslint to v7.23.0 (#71)
0565c0a chore(deps): update all non-major dependencies (#74)
172a379 chore(deps): update all non-major dependencies (#73)
c4b6039 chore(deps): update all non-major dependencies (#69)

v0.6.1

18 Mar 22:56
Compare
Choose a tag to compare

Changelog

f69316f fix(deps): update dependency rollbar to v2.21.1 (#68)
325b0c6 fix(cd): update version action
893b5dd chore(release): v0.6.1
f94b198 chore(release): v0.6.0
165e3b8 chore(npm): update commit message template on version
55ec2fb chore(deps): update node.js to v14
5f36838 chore(deps): update dependency husky to v5
fe56e11 chore(deps): update all non-major dependencies (#67)
0540bb2 chore(cd): added push button deployments

0.5.0

20 Aug 21:55
52ad2cf
Compare
Choose a tag to compare

@goodwaygroup/lib-hapi-rollbar

CircleCI

Please do not run this plugin within tests in your application

Usage

This plugin will push exceptions to Rollbar.

$ yarn add @goodwaygroup/lib-hapi-rollbar

In your index.js for the Hapi server, register the plugin:

// Rollbar
if (process.env.ROLLBAR_TOKEN && ['production', 'staging'].indexOf(process.env.NODE_ENV) > -1) {
    await server.register({
        plugin: require('@goodwaygroup/lib-hapi-rollbar'), // eslint-disable-line global-require
        options: {
            accessToken: process.env.ROLLBAR_TOKEN,
            captureEmail: true,
            captureUncaught: true,
            captureUnhandledRejections: true,
            omittedResponseCodes: [400, 401, 404, 409],
            codeVersion: require('../package.json').version // eslint-disable-line global-require
        }
    });
} else {
    // passthru helper method to clean up code when rollbar is not configured
    server.decorate('request', 'sendRollbarMessage', () => {});
}

Configuration Options

When passing a configuration option, it will overwrite the defaults.

You can pass in any configuration option for the Rollbar library.

Custom options:

  • omittedResponseCodes: An ARRAY of HTTP codes (as integers) to not report to Rollbar.
    • Defaults to [], but we recommend [400, 401, 404, 409] to avoid spam exceptions.

Person Tracking

The plugin uses the standard Person Tracking features. To ensure you are passing the correct info to Rollbar, place the data you want to track in the request.auth.credentials object. This will be copied to request.rollbar_person when pushing the exception to Rollbar.

Send Custom Message

You can send custom messages to Rollbar via the request.sendRollbarMessage decorator. It will default to the error level. You use any Rollbar supported level:

debug
info
warning
error
critical

Example call:

request.sendRollbarMessage({
    level: 'warning', // defaults to 'error'
    message: 'Custom Message',
    payload: { custom: { payload: 'data' } }
})

Send Custom object

Rollbar allows a custom object to be passed through and sent in the payload delivered to a Rollbar occurence (see here). In lib-hapi-rollbar, we couple this to Boom such that any data passed in as an argument to a Boom error will be delivered through to Rollbar. For example, Boom.badImplementation('message', data) will result in the contents of data landing as part of the Rollbar occurence report.

Running Tests

To run tests, just run the following:

yarn test

All commits are tested on CircleCI

Linting

To run eslint:

yarn lint

To auto-resolve:

yarn lint:fix

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use milestones and npm version to bump versions. We also employ auto-changelog to manage the CHANGELOG.md. For the versions available, see the tags on this repository.

To initiate a version change:

yarn version

Authors

  • Derek Smith - Initial work - @clok

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

Sponsors

goodwaygroup