From cc89185eb6c4d7599e2466d4df3739f97d05ccce Mon Sep 17 00:00:00 2001 From: Brian Anstett Date: Thu, 27 May 2021 14:32:01 -0400 Subject: [PATCH] Lambda Layer support --- CHANGELOG.md | 11 +++++++++++ index.js | 2 +- package.json | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..434f082 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.1.2] - 2021-05-27 +### Changed +- Updated the logic gate to determine if the code is running in a container or Lambda. It now uses `AWS_LAMBDA_FUNCTION_NAME` instead of `AWS_EXECUTION_ENV` since `AWS_LAMBDA_FUNCTION_NAME` isn't always set which caused issues when using this package in a Lambda layer. \ No newline at end of file diff --git a/index.js b/index.js index ed914b3..f6a594d 100644 --- a/index.js +++ b/index.js @@ -69,7 +69,7 @@ module.exports = async function getSecret(secretPath, options = {}) { // If the user passed in an existing Vault token, you that. Don't go through the process of generating one if (token == null) { // Determine if being called in Lambda or container. - if (process.env.AWS_EXECUTION_ENV) { + if (process.env.AWS_LAMBDA_FUNCTION_NAME) { // Running in Lambda. Make necessary assumptions. if (!vaultRole) throw new Error('Requires either options.vaultRole or VAULT_ROLE environment variable.'); vaultClient = new VaultAwsAuth({ diff --git a/package.json b/package.json index 293bc9d..d66fe21 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@24g/vault", - "version": "1.1.1", + "version": "1.1.2", "description": "Module for interacting with Vault", "main": "index.js", "scripts": {