Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

@henrist/cdk-lambda-config

Package Overview
Dependencies
0
Maintainers
1
Versions
117
Issues
File Explorer

Advanced tools

@henrist/cdk-lambda-config

CDK Construct for adding config.json file to a Lambda Function

    2.1.21latest
    GitHub

Version published
Maintainers
1
Weekly downloads
1,457
decreased by-14.14%

Weekly downloads

Changelog

Source

v2.1.21

2.1.21 (2023-03-26)

Bug Fixes

  • deps: update dependency webpack to v5.76.3 (850bfbe)

Readme

Source

CDK Construct for adding config.json file to a Lambda Function

When using Lambda@Edge, a function cannot use environment variables. This CDK Construct uses a Custom Resource to inject a config.json file with user provided values into an existing function, and publishes a new version that is ready to be used as part of a CloudFront Distribution.

Inspired by similar mechanism in https://github.com/aws-samples/cloudfront-authorization-at-edge/

Usage

npm install @henrist/cdk-lambda-config

Using the construct:

const originalFunction = lambda.Function.fromFunctionArn(...) const updatedFunction = new LambdaConfig(this, "UpdatedFunction", { function: originalFunction, config: { Key1: "Some value", Nested: { Key2: "Other value", }, }, nonce: "1", // See TSDoc. } // Can now retrieve the new version: updatedFunction.version

Read from within the handler:

const fs = require("fs") const path = require("path") const config = JSON.parse( fs.readFileSync(path.join(__dirname, "config.json"), "utf-8"), )

Keywords

FAQs

Last updated on 26 Mar 2023

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc