Package Exports
- lambda-rollbar
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lambda-rollbar) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Lambda-Rollbar Wrapper
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, callback, rb) => rb
.warning("Some Warning...")
.then(callback(null, { 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")
.
Request Templates
Lambda functions are called in different context. Using the template
option you can define which context should be assumed. Currently supported are:
aws-sls-lambda-proxy
(default) - Default event template for API Gateway using the Serverless Frameworkaws-cloud-watch
- For CloudWatch logs events
Contributions / What is next
- Templates - Adding more templates is easy and PRs are welcome! Sample events can be found here.