Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

simlu/lambda-rollbar

Open more actions menu
 
 

Repository files navigation

Lambda-Rollbar Wrapper

Build Status Test Coverage Dependabot Status Dependencies NPM Downloads Semantic-Release Gardener

Rollbar wrapper for Serverless, API Gateway and Lambda.

Getting Started

To install run npm install --save lambda-rollbar

Usage

Define rollbar and wrap handlers with

const rollbar = require('lambda-rollbar')({
  accessToken: 'YOUR_ROLLBAR_ACCESS_TOKEN',
  environment: 'YOUR_ENVIRONMENT',
  enabled: true,
  template: 'aws-sls-lambda-proxy'
});

exports.handler = rollbar.wrap((event, context, rb) => rb
  .warning('Some Warning...')
  .then({ statusCode: 200, body: '{"message":"Hello World."}' }));

Available log levels are debug, info, warning, error and critical.

You can set an environment on a per call bases using rb.warning("YOUR_MESSAGE", "YOUR_ENVIRONMENT").

Verbose Option

Use the boolean verbose option to log messages to console. This option also get's passed through into rollbar.

Request Templates

Lambda functions are called in different request context. Using the template option you can define which request context should be assumed. Currently supported are:

Contributions / What is next

  • Templates - Adding more templates is easy and PRs are welcome! Sample events can be found here. Make sure you only use fields listed under request, i.e. url, method, body.

About

Rollbar wrapper for Serverless, API Gateway and Lambda.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.