terraform-aws-modules/terraform-aws-lambda

failed build with lambda module in windows

KamranBiglari opened this issue · 3 comments

Description

There is an issue with building a nodejs app with lambda module in Windows.

│ Error: local-exec provisioner error
│
│   with module.nchan_data_loader.null_resource.archive[0],
│   on .terraform\modules\nchan_data_loader\package.tf line 67, in resource "null_resource" "archive":
│   67:   provisioner "local-exec" {
│
│ Error running command 'builds\b5c5c610125202ff7844366eeb0d721fb926cf7f15b1d0f8873807bcac746c3d.plan.json': exit status 1. Output: zip: creating
│ 'builds\b5c5c610125202ff7844366eeb0d721fb926cf7f15b1d0f8873807bcac746c3d.zip' archive
│ zip: Error during zip archive creation
│ Traceback (most recent call last):
│   File "D:\Project\fiat-coreapi\terraform\.terraform\modules\nchan_data_loader\package.py", line 1516, in build_command
│     bpm.execute(build_plan, zs, query)
│   File "D:\Project\fiat-coreapi\terraform\.terraform\modules\nchan_data_loader\package.py", line 891, in execute
│     p = subprocess.Popen(script, shell=True, cwd=path,
│         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
│   File "C:\Program Files\Python311\Lib\subprocess.py", line 1024, in __init__
│     self._execute_child(args, executable, preexec_fn, close_fds,
│   File "C:\Program Files\Python311\Lib\subprocess.py", line 1419, in _execute_child
│     assert not pass_fds, "pass_fds not supported on Windows."
│ AssertionError: pass_fds not supported on Windows.

Versions

  • Module version: 6.0.0
  • Python version: 3.11
  • Terraform version: v1.4.5
module "nchan_data_loader" {
  source                 = "terraform-aws-modules/lambda/aws"
  version                = "6.0.0"
  function_name          = "${var.APP_NAME}-nchan-dataloader"
  description            = "${var.APP_NAME} nchan data loader lambda function"
  handler                = "dist/index.handler"
  runtime                = "nodejs18.x"
  timeout                = 15
  maximum_retry_attempts = 0
  create_package         = true
  source_path = [
    {
      path = "${path.module}/../nchan-data-loader/"
      commands = [
        "npm i",
        "npm run ncc",
        ":zip"
      ]
      patterns = [
        "!node_modules/.*",
        "!src/.*",
        "!node_modules",
        "!node_modules/",
        "!./node_modules",
        "!node_modules/*",
      ]
    }
  ]
  publish                           = true
  vpc_subnet_ids                    = local.PRIVATE_SUBNETS
  vpc_security_group_ids            = [aws_security_group.nchan_dataloader.id]
  ignore_source_code_hash           = false
  cloudwatch_logs_retention_in_days = 14
  attach_network_policy             = true

  attach_policies    = true
  number_of_policies = 1

  environment_variables = { for k, v in local.NCHAN_DATALOADER.ENVIRONMENT_VARIALBES : k => v }

  policies = [
    "arn:aws:iam::aws:policy/CloudWatchFullAccess"
  ]
  tags = {
    Name = "${var.APP_NAME}-nchan-dataloader"
  }
  depends_on = [
    aws_security_group.nchan_dataloader
  ]
}

This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days

This issue was automatically closed because of stale in 10 days

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.