0

I have the same problem as this user : Index handler is undefined or not exported

But i zip my content of folder with terraform and i have this problem

"errorType": "Runtime.HandlerNotFound", "errorMessage": "index.handler is undefined or not exported"

When i zip with terraform it's zip me two times look:

The first one "getversion-back" it's when i take my zip of lambda and the second one "code_back" it's when i unzip

Do you have any idea to solve this problem ?

TukTuk
  • 1
  • 2
  • And you have a method / property called `handler` in your index.js? – luk2302 Mar 31 '23 at 15:39
  • Yes. The problem is that when I zip it on my machine and I put it manually on the lambda I don't have this problem, this is when i go through terraform i have this problem – TukTuk Mar 31 '23 at 16:30
  • The problem is that terraform zips me the file twice and that's why I have the problem Is there a way to tell him to zip my file once? – TukTuk Apr 03 '23 at 09:03

1 Answers1

0

The problem was the module I was using, going through the resources I no longer have this problem, and the code is :

data "archive_file" "lambda_zip" {
type        = "zip"
source_dir  = "source"
output_path = "lambda.zip"
}
filename = "lambda.zip"
source_code_hash = "${data.archive_file.lambda_zip.output_base64sha256}"
function_name = "my_lambda"
role = "${aws_iam_role.lambda.arn}"
description = "Some AWS lambda"
handler = "index.handler"
runtime = "nodejs4.3"
}

I close the topic

TukTuk
  • 1
  • 2