TypeError: ecs.tagResource is not a function

0

Hi,

Trying to work out why I cant tag a Running ECS Task via Lambda. I've enabled the new ARNs in ECS. Using Node.js 6.10 runtime. Error message seems to indicate that the function doesnt exist on the object Im calling (See Code).

What am I doing wrong, is the function on a different object? Also if I try to tag when starting the task, it tells me that the "tags" property is unexpected.

Many Thanks!
Paul.

Example Code:
'use strict';

var AWS = require('aws-sdk');
var ecs = new AWS.ECS();

exports.handler = (event, context, callback) => {
if(event['id'] && event.id!=null && event.id.length>0){
var params = {
resourceArn: process.env.PREFIX _ "/" _ event.id,
tags: [
{
key: "TestTag",
value: "TestTag"
}
]
};
ecs.tagResource(params, function(err, data) {
if (err){
console.log(err, err.stack); // an error occurred
callback(null, { status: true });
} else {
console.log(data); // successful response
callback(null, { status: true });
}
});
}else{
callback(null, { status: true });
}
};

Output:
2019-05-10T17:03:12.966Z 7ae84b85-846f-4638-845c-3414fc96f009 TypeError: ecs.tagResource is not a function
at exports.handler (/var/task/index.js:17:14)

질문됨 5년 전348회 조회
1개 답변
0

Fixed by changing the run time. Had to use NodeJS 10.x.

답변함 5년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠