@serverless/sdk-beta

0.4.0 • Public • Published

sdk

Install

npm i --save @serverless/sdk-beta

How to use

Wrap your function with the SDK's trackHandler:

const sdk = require('@serverless/sdk-beta')('testAPIKey');

// Your function handler
module.exports.hello = sdk.trackHandler((event, context, cb) => {
  cb(null, {
    message: 'Go Serverless v1.0! Your function executed successfully!', event
  });
});

API

trackHandler(handler, tags)

Track handler function invocations.

Arguments:

  • handler - required - function to track by SDK.
  • tags - optional object with custom tags e.g. {'owner': 'teamA'}. Each key/value pair is treated as separate tag. region and runtime tags are added to each invocation.

Tracking errors

Errors thrown from within handler function are automatically tracked.

module.exports.hello = sdk.trackHandler((event, context, cb) => {
  throw new Error('Whoops!');
});

Readme

Keywords

none

Package Sidebar

Install

npm i @serverless/sdk-beta

Weekly Downloads

1

Version

0.4.0

License

none

Last publish

Collaborators