🚀 Socket Launch Week 🚀 Day 5: Introducing Socket Fix.Learn More

@serverless/sdk-beta

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@serverless/sdk-beta

## Install

0.4.0
latest
Version published
Maintainers
4
Created

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!');
});

FAQs

Package last updated on 15 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts