Home

Awesome

IOpipe Serverless Framework Plugin

serverless CircleCI styled with prettier semantic-release

A serverless plugin to automatically wrap your functions with iopipe.

Requirements

Install

With yarn (recommended) in project directory:

yarn add @iopipe/iopipe
yarn add serverless-plugin-iopipe --dev

OR with npm in project directory:

npm install @iopipe/iopipe
npm install serverless-plugin-iopipe --save-dev

Add the plugin to your serverless.yml file:

plugins:
  - serverless-plugin-iopipe

You'll need to make sure your lambda functions have access to your IOpipe project token. The recommended strategy is to use an environment variable. Just setup the variable in serverless.yml like any other.

environment:
  IOPIPE_TOKEN: ${env:IOPIPE_TOKEN}

Alternatively, you can add an iopipe configuration to your package.json.

You're set! The plugin will run during an sls deploy or during sls invoke local.

Check out an example here.

How Does it Work?

serverless-plugin-iopipe outputs files that import and wrap the function handlers defined in serverless.yml with IOpipe so you don't have to. It allows you to deploy and upgrade multiple functions simultaneously.

Commands

Options

Beyond the required $IOPIPE_TOKEN environment variable, some options can be set in the "custom" config in serverless.yml. See Example

iopipeToken (optional)

If not using the environment variable of $IOPIPE_TOKEN, the token of the project you would like to wrap your functions with.

iopipeNoVerify (optional)

Skip a check that ensures iopipe is installed via npm/yarn and present in package.json

iopipeNoUpgrade (optional)

The plugin automatically upgrades the IOpipe library to the latest available version that satisfies the semver range specified in package.json. Use this option to disable that feature.

iopipeNoYarn (optional)

When auto-upgrading, Yarn will be used in place of NPM if a yarn.lock file is found. Use this flag disable yarn and use NPM to upgrade the iopipe library.

iopipeExclude (optional)

Exclude certain lambda functions from being wrapped by the plugin. Comma separated string.

iopipeNoStats (optional)

By default, the plugin sends anonymized, non-identifying usage statistics to Google Analytics. IOpipe will use this info to prioritize updates and enhancements to the plugin. If you'd like to opt out of this, just set this option.

iopipeHandlerDir (optional)

Change the directory that the IOpipe handler files will be generated in. Defaults to iopipe_handlers. Note, watch out using directories beginning with a . character due to current bugs within Serverless framework and serverless-offline:

FAQ

Known Issues

Support

File an issue here, hit us up on Slack, or send us a note at support@iopipe.com

Contributing