terraform-aws-modules / terraform-aws-lambda

Terraform module, which takes care of a lot of AWS Lambda/serverless tasks (build dependencies, packages, updates, deployments) in countless combinations 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/lambda/aws
Apache License 2.0
886 stars 656 forks source link

failed build with lambda module in windows #495

Closed KamranBiglari closed 9 months ago

KamranBiglari commented 10 months ago

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 "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
  ]
}
github-actions[bot] commented 9 months ago

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

github-actions[bot] commented 9 months ago

This issue was automatically closed because of stale in 10 days

github-actions[bot] commented 8 months ago

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.