From 0742810c1c0625390be934599e9e691353810804 Mon Sep 17 00:00:00 2001 From: Maurice Rickard Date: Tue, 9 Jul 2019 19:29:47 -0400 Subject: [PATCH] Shimming arn for local invocation Updating dependencies Adding JetBrains files to .gitignore Closes #54 --- .gitignore | 1 + package.json | 8 ++++---- src/index.js | 13 ++++++++++--- yarn.lock | 28 ++++++++++++++++++++++------ 4 files changed, 37 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index de4d1f0..a284d13 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ dist node_modules +.idea diff --git a/package.json b/package.json index 3d95b58..159fd8c 100644 --- a/package.json +++ b/package.json @@ -35,16 +35,16 @@ }, "devDependencies": { "@iopipe/scripts": "^1.4.1", - "aws-lambda-mock-context": "^3.1.1", - "lodash": "^4.17.4", + "aws-lambda-mock-context": "^3.2.1", + "lodash": "^4.17.11", "nock": "^9.4.1", "pre-commit": "^1.2.2" }, "dependencies": { - "@iopipe/core": "^1.13", + "@iopipe/core": "^1.19.1", "archiver": "^2.1.1", "lodash.get": "^4.4.2", - "simple-get": "^3.0.2" + "simple-get": "^3.0.3" }, "peerDependencies": {}, "jest": { diff --git a/src/index.js b/src/index.js index 4be7c1a..3265bc0 100644 --- a/src/index.js +++ b/src/index.js @@ -109,16 +109,23 @@ class ProfilerPlugin { getFileUploadMeta() { // returns a promise here + let { invokedFunctionArn: arn } = this.invocationInstance.context; + const { - invokedFunctionArn: arn, - awsRequestId: requestId + awsRequestId: requestId, + functionName } = this.invocationInstance.context; + if (arn === undefined || process.env.AWS_SAM_LOCAL) { + arn = `arn:aws:lambda:local:0:function:${functionName}`; + } + return coreUtil.getFileUploadMeta({ auth: this.token, networkTimeout: this.config.networkTimeout, arn, - requestId + requestId, + functionName }); } diff --git a/yarn.lock b/yarn.lock index 17c0fcc..c1bab88 100644 --- a/yarn.lock +++ b/yarn.lock @@ -78,9 +78,10 @@ lodash "^4.2.0" to-fast-properties "^2.0.0" -"@iopipe/core@^1.13": - version "1.13.0" - resolved "https://registry.yarnpkg.com/@iopipe/core/-/core-1.13.0.tgz#0fbbace7a58497af1fbda68eb1ab97f1f988ddb3" +"@iopipe/core@^1.19.1": + version "1.19.1" + resolved "https://registry.yarnpkg.com/@iopipe/core/-/core-1.19.1.tgz#19da388f0c900f4551915c71993b4c1269979970" + integrity sha512-JyEcARVnE+TMYodEu9jV61CpWGqmBaAqfvUWX1m5ot1kzbXDS5gvnD/opYsNRteALluiLcb42TRxlEuPCTmijQ== dependencies: cosmiconfig "^4" lodash.uniqby "^4.7.0" @@ -615,9 +616,10 @@ atob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.1.tgz#ae2d5a729477f289d60dd7f96a6314a22dd6c22a" -aws-lambda-mock-context@^3.1.1: - version "3.2.0" - resolved "https://registry.yarnpkg.com/aws-lambda-mock-context/-/aws-lambda-mock-context-3.2.0.tgz#6c0769669c857539cfc08d8db14da1e91c2ed904" +aws-lambda-mock-context@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/aws-lambda-mock-context/-/aws-lambda-mock-context-3.2.1.tgz#c84fe6bdec8dedb2d5d6a5e1e8e43e4f12aae709" + integrity sha512-mBqUustp9Q6yfa7w0L8UT8XJVTlIaeZTtxhvRQEEM3uhZwzQ1/l1NNN9i4F+O6CbYEOu9jDODLMCymV/J7pSYA== dependencies: moment "^2.10.5" pinkie-defer "^1.0.0" @@ -5043,6 +5045,11 @@ lodash@^4.0.0, lodash@^4.11.2, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, version "4.17.10" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" +lodash@^4.17.11: + version "4.17.11" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" + integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== + log-symbols@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18" @@ -6817,6 +6824,15 @@ simple-get@^3.0.2: once "^1.3.1" simple-concat "^1.0.0" +simple-get@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-3.0.3.tgz#924528ac3f9d7718ce5e9ec1b1a69c0be4d62efa" + integrity sha512-Wvre/Jq5vgoz31Z9stYWPLn0PqRqmBDpFSdypAnHu5AvRVCYPRYGnvryNLiXu8GOBNDH82J2FRHUGMjjHUpXFw== + dependencies: + decompress-response "^3.3.0" + once "^1.3.1" + simple-concat "^1.0.0" + slash@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55"