@cumulus/cumulus-ecs-task
Advanced tools
Comparing version 1.2.3 to 1.2.4
@@ -9,2 +9,8 @@ # cumulus-ecs-task change log | ||
## [v1.2.4] | ||
### Fixed | ||
- **CUMULUS-953** - The lambdaArn parameter will accept a Lambda ARN or a Lambda | ||
function name. | ||
## [v1.2.3] | ||
@@ -11,0 +17,0 @@ |
49
index.js
@@ -0,3 +1,5 @@ | ||
/* eslint max-len: "off" */ | ||
'use strict'; | ||
/* eslint-disable no-console, max-len */ | ||
const https = require('https'); | ||
@@ -18,2 +20,20 @@ const path = require('path'); | ||
// eslint-disable-next-line require-jsdoc | ||
const isLambdaFunctionArn = (id) => id.startsWith('arn:aws:lambda'); | ||
// eslint-disable-next-line require-jsdoc | ||
function getFunctionName(lambdaId) { | ||
if (isLambdaFunctionArn(lambdaId)) { | ||
const FUNCTION_NAME_FIELD = 6; | ||
return lambdaId.split(':')[FUNCTION_NAME_FIELD]; | ||
} | ||
return lambdaId; | ||
} | ||
// eslint-disable-next-line require-jsdoc | ||
const getLogSenderFromLambdaId = (lambdaId) => | ||
`cumulus-ecs-task/${getFunctionName(lambdaId)}`; | ||
/** | ||
@@ -257,10 +277,3 @@ * Download a URL to file | ||
const lambdaFunctionNameMatch = lambdaArn.match(/:function:([^:]+)/); | ||
if (lambdaFunctionNameMatch) { | ||
log.sender = `cumulus-ecs-task/${lambdaFunctionNameMatch[1]}`; | ||
} | ||
else { | ||
const err = new TypeError(`Unable to determine lambda function name from ${lambdaArn}`); | ||
log.error(`Unable to determine lambda function name from ${lambdaArn}`, err); | ||
} | ||
log.sender = getLogSenderFromLambdaId(lambdaArn); | ||
@@ -313,10 +326,3 @@ // the cumulus-message-adapter dir is in an unexpected place, | ||
const lambdaFunctionNameMatch = lambdaArn.match(/:function:([^:]+)/); | ||
if (lambdaFunctionNameMatch) { | ||
log.sender = `cumulus-ecs-task/${lambdaFunctionNameMatch[1]}`; | ||
} | ||
else { | ||
const err = new TypeError(`Unable to determine lambda function name from ${lambdaArn}`); | ||
log.error(`Unable to determine lambda function name from ${lambdaArn}`, err); | ||
} | ||
log.sender = getLogSenderFromLambdaId(lambdaArn); | ||
@@ -397,10 +403,3 @@ // the cumulus-message-adapter dir is in an unexpected place, | ||
const lambdaFunctionNameMatch = lambdaArn.match(/:function:([^:]+)/); | ||
if (lambdaFunctionNameMatch) { | ||
log.sender = `cumulus-ecs-task/${lambdaFunctionNameMatch[1]}`; | ||
} | ||
else { | ||
const err = new TypeError(`Unable to determine lambda function name from ${lambdaArn}`); | ||
log.error(`Unable to determine lambda function name from ${lambdaArn}`, err); | ||
} | ||
log.sender = getLogSenderFromLambdaId(lambdaArn); | ||
@@ -407,0 +406,0 @@ // the cumulus-message-adapter dir is in an unexpected place, |
{ | ||
"name": "@cumulus/cumulus-ecs-task", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "Run lambda functions in ECS", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53912
830