open-index/open-npm huggingface dataset:
npm package: @serverless/sdk-beta
Description: ## Install
Latest version: 0.4.0

# sdk

## Install

```
npm i --save @serverless/sdk-beta
```

## How to use

Wrap your function with the SDK's `trackHandler`:

```js
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.

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