JSPM

nodejs-with-powertools-function

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 55
  • Score
    100M100P100Q82367F
  • License Apache-2.0

Simple wrapper for NodejsFunction that enables the Powertools Layer.

Package Exports

  • nodejs-with-powertools-function
  • nodejs-with-powertools-function/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nodejs-with-powertools-function) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

NodejsWithPowertoolsFunction - CDK Construct

A simple wrapper for the NodejsFunction construct that enables the Powertools Layer.

Getting Started

The construct aims to be a drop-in replacement to the NodejsFunction. The only thing that has to be adjusted is, that the function calls to the NodejsFunction has to be on the property fn from the NodejsWithPowertoolsFunction.

import { NodejsWithPowertoolsFunction } from 'nodejs-with-powertools-function';

class MyStack extends Stack {
  constructor(scope: Construct, id: string) {
    super(scope, id);

    const myFunction = new NodejsWithPowertoolsFunction(this, 'PowertoolsFunction', {
      entry: __dirname + '/my-lambda-function.ts',
      powertoolsVersion: '10',
      powertoolsEnvironmentVariables: {
        POWERTOOLS_SERVICE_NAME: 'my-cool-service'
      }
    });
    
    myFunction.fn.addToRolePolicy(
      new PolicyStatement({
      actions: ['kms:*'],
      resources: ['*'],
      effect: Effect.ALLOW,
    }));
  }
}

Prerequisites

To use this construct, the AWS CDK has to be installed.

npm i aws-cdk-lib

Installing

To install the construct, just install it with your favorite package manager from the npm registry:

npm i nodejs-with-powertools-function 

Built With

  • projen - The project generation tool

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details