Я столкнулся с проблемой с моей AWS лямбда-функцией триггера, когда на консоли появляется надпись Lambda can't find the file test_lambda.js. Make sure that your handler upholds the format: file-name.method.
Вот мой соответствующий код. Вот сама лямбда-функция -
resource "aws_lambda_function" "development_lambda" {
function_name = "test_lambda"
role = "${aws_iam_role.iam_for_lambda.arn}"
handler = "test_lambda"
runtime = "nodejs10.x"
filename = "test_lambda.js.zip"
source_code_hash = "${filebase64sha256("test_lambda.js.zip")}"
timeout = 10
vpc_config {
subnet_ids = flatten(["${private_subnet_ids}"])
security_group_ids = flatten(["${security_group_id}"])
}
environment {
variables = {
env = "localhost"
}
}
}
Here is the event source mapping code -
resource "aws_lambda_event_source_mapping" "event_source_mapping" {
event_source_arn = "${aws_sqs_queue.development-queue.arn}"
enabled = true
function_name = "${aws_lambda_function.development_lambda.arn}"
batch_size = 10
}
And here is the lambda handler in file `test_lambda.js`
exports.handler = (event, context, callback) => {
console.log("Lambda test");
callback(null, 'In Lambda');
};
I also have a test_lambda.js.zip in the same path.
Что здесь не так?