@serverless/sdk-beta
v0.4.0
Published
## Install
Downloads
5
Readme
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
andruntime
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!');
});