Skip to content

npm_requirements does not work correctly #506

Closed
@phildier

Description

@phildier

Description

When using npm_requirements to automatically run npm install during package build, this parameter is ignored. If you have already run npm install in the source directory the zip task will happily include node_modules, but in a new project or CI/CD nothing happens. This is due to the actual reference to the claim parameter in package.py pointing to npm_package_json instead of npm_requirements. When updating the claim to use npm_package_json it works correctly. However the documentation doesn't match this requirement. From this PR #293 it appears that the developer intended to use npm_requirements but forgot to change the claim reference in package.py before committing.

Reproduction Code [Required]

  source_path = [
    {
      path             = "${path.module}/collect_queue_metrics/",
      npm_requirements = true,
    }
  ]

Start with a new nodejs lambda project that uses a package.json to install dependencies which aren't included by default by the lambda runtime. terraform apply and note that npm install does not run. Change the above npm_requirements to npm_package_json and note that npm install does in fact run.

Expected behavior

Expect npm install to run when using the claim property described in the documentation.

Actual behavior

npm install does not run when using the claim property described in the documentation.

Additional Context

  1. feat: Add support to build automatically npm dependencies #293
  2. https://github.com/terraform-aws-modules/terraform-aws-lambda/blob/master/package.py#L794

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions