fusebit/everynode

Runtime.ErrorLoadingHandler when using es6 exports

Closed this issue · 7 comments

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
}

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

@yspreen thank you for reporting, we will look into this asap

@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.

@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.

thanks so much @tjanczuk ! I have to use a bundler anyways, as indicated in #3 , so I don't need module support anymore. I think we can close this and if someone comes up on this in the future, they can reopen if the issue persists 👍

@yspreen what is that "tf" file?

I am trying to use node 16, see #11 and I am using Typescript, compiling to commonjs

@paul-uz it's terraform. infrastructure as code to make deployments more reproducible