Module 4.2.0 fails to package lambda when using nodejs14.x since it is trying to call nodejs14.x as a cli command
Andrey9kin opened this issue · 4 comments
Description
Please provide a clear and concise description of the issue you are encountering, and a reproduction of your configuration (see the examples/*
directory for references that you can copy+paste and tailor to match your configs if you are unable to copy your exact configuration). The reproduction MUST be executable by running terraform init && terraform apply
without any further changes.
If your request is for a new feature, please use the Feature request
template.
-
✋ I have searched the open/closed issues and my issue is not listed.
Versions
- Module version [Required]:
4.2.0 - Terraform version:
1.1.9 - Provider version(s):
Terraform v1.1.9
on linux_amd64
+ provider registry.terraform.io/hashicorp/aws v4.36.1
+ provider registry.terraform.io/hashicorp/external v2.2.2
+ provider registry.terraform.io/hashicorp/local v2.2.3
+ provider registry.terraform.io/hashicorp/null v3.1.1
Reproduction Code [Required]
module "lambda" {
source = "terraform-aws-modules/lambda/aws"
version = "4.2.0"
function_name = local.name
description = ""
handler = "index.handler"
runtime = "nodejs14.x" # important part
publish = true
source_path = "${path.root}/../../export_modules/XXXX/XXX/XXX"
Steps to reproduce the behavior:
Use nodejs14.x runtime, seems to be reproducible 100%. It appears that module is using runtime value as cli command name and attempting to call it. It would work fine with python but not with nodejs
Expected behavior
Plan pass
Actual behavior
Plan failed with the error below
Terminal Output Screenshot(s)
│ Error: External Program Execution Failed
│
│ with module.XXXXX.module.lambda.data.external.archive_prepare[0],
│ on .terraform.127163811057-eu-central-1/modules/pss_export_products_last_10_orders.lambda/package.tf line 10, in data "external" "archive_prepare":
│ 10: program = [local.python, "${path.module}/package.py", "prepare"]
│
│ The data source received an unexpected error while attempting to execute the program.
│
│ Program: /usr/bin/python3
│ Error Message: Traceback (most recent call last):
│ File ".terraform.127163811057-eu-central-1/modules/pss_export_products_last_10_orders.lambda/package.py", line 1403, in <module>
│ main()
│ File ".terraform.127163811057-eu-central-1/modules/pss_export_products_last_10_orders.lambda/package.py", line 1399, in main
│ exit(args.command(args))
│ File ".terraform.127163811057-eu-central-1/modules/pss_export_products_last_10_orders.lambda/package.py", line 1198, in prepare_command
│ build_plan = bpm.plan(source_path, query)
│ File ".terraform.127163811057-eu-central-1/modules/pss_export_products_last_10_orders.lambda/package.py", line 745, in plan
│ npm_requirements_step(
│ File ".terraform.127163811057-eu-central-1/modules/pss_export_products_last_10_orders.lambda/package.py", line 679, in npm_requirements_step
│ raise RuntimeError(
│ RuntimeError: Nodejs interpreter version equal to defined lambda runtime (nodejs14.x) should be available in system PATH
│
│ State: exit status 1
Additional context
@lorengordon is it supposed to behave like that? I can see how it will work for python but for not sure what to do for nodejs14.x
See #364
Fixed in #364
I'm going to lock this issue because it has been closed for 30 days