Runtime.ErrorLoadingHandler when using es6 exports
Closed this issue · 7 comments
yspreen commented
I'm getting the following error:
Unknown application error occurred
Runtime.ErrorLoadingHandler
And the only thing I'm changing between it working and this failure state is the node version. Previously I was using AWS' node14. Here's my js:
// index.js
export async function entry(event) {
return {
statusCode: 200,
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
result: 'success',
}),
};
}
tf:
resource "aws_lambda_function" "api_api" {
function_name = random_pet.lambda_api_function.id
s3_bucket = aws_s3_bucket.api_bucket.id
s3_key = aws_s3_bucket_object.api_bucket_obj.key
runtime = "provided"
layers = ["arn:aws:lambda:us-east-1:072686360478:layer:node-16_9_1:3"] # https://github.com/fusebit/everynode
handler = "index.entry"
source_code_hash = data.archive_file.lambda_api.output_base64sha256
role = aws_iam_role.api_exec.arn
tags = var.tags
}
yspreen commented
I used babel to build the env preset. That seems to do the trick. ES6 is not supported maybe? Would be great to get some docs for this at least
tjanczuk commented
@yspreen The fix to support ES6 in Node >=14 is in, but the buildout of layers will take a few hours. I will drop a note here when done.
tjanczuk commented
@yspreen The layers with support for ES6 in Node >=14 are now deployed to every region - grab them from the catalog https://github.com/fusebit/everynode#any-region-any-nodejs-version-one-lambda. Let me know if this fixes the issue.
yspreen commented
paul-uz commented