Socket
Book a DemoInstallSign in
Socket

@serverless/aws-lambda-sdk

Package Overview
Dependencies
Maintainers
6
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@serverless/aws-lambda-sdk

## AWS Lambda dedicated tracing utility

Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
136
-18.07%
Maintainers
6
Weekly downloads
 
Created
Source

@serverless/aws-lambda-sdk

AWS Lambda dedicated tracing utility

Instruments AWS Lambda functions and propagates traces to the Serverless Console

Setup

1. Register with Serverless Console

2. Instrument functions with the SDK in one of the following ways:

(A) Attach internal extension layer

Resolve Layer ARN with following steps

  • Search for latest release of @serverless/aws-lambda-sdk at https://github.com/serverless/console/releases
  • In attached sls-sdk-node.json asset, find ARN of a layer in a region in which function is deployed
  • Attach layer to the function
  • Configure following environment variables for the function environment:
    • SLS_ORG_ID: (id of your organization in Serverless Console)
    • AWS_LAMBDA_EXEC_WRAPPER: /opt/sls-sdk-node/exec-wrapper.sh
(B) Instrument function manually
  • Ensure @serverless/aws-lambda-sdk dependency installed for the function

  • Decorate function handler:

CJS:

const instrument = require('@serverless/aws-lambda-sdk/instrument');

module.exports.handler = instrument(
  (event, context, callback) => { /* Original handler logic */ },
  // Optional
  {
    orgId: <orgId> // By default taken from SLS_ORG_ID env variable
  }
);

ESM:

import instrument from '@serverless/aws-lambda-sdk/instrument';

export const handler = instrument(
  (event, context, callback) => { /* Original handler logic  */ },
  // Optional
  {
    orgId: <orgId> // By default taken from SLS_ORG_ID env variable
  }
);

Outcome

SDK automatically creates the trace that covers internal process of function invocation and initialization.

For all the details check docs/sdk-trace.md

FAQs

Package last updated on 29 Aug 2022

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