Skip to content

[@aws-cdk/assets] docs issue - Negate exclude pattern doesn't work #9146

@aecollver

Description

@aecollver

I'm unable to use a negated exclude glob to create an asset for a Lambda function with a single source code file.

Reproduction Steps

new Function(this, "DeployAction", {
  runtime: Runtime.NODEJS_12_X,
  code: new AssetCode(__dirname, {
    exclude: ["!deploy.js"]
  }),
  handler: "deploy.handler",
});

Error Log

No error - the asset ZIP doesn't respect the negated exclude (it contains deploy.js + the files I was trying to exclude).

The same exclude, but without negation (deploy.js) does work (deploy.js is excluded from the asset zip).

Environment

  • CLI Version : N/A (I don't have a global CDK installation)
  • Framework Version: 1.39.0 (build 5d727c1)
  • Node.js Version: v12.13.1
  • OS : Mac OS 10.13.6
  • Language (Version): TypeScript 3.7.5

This is 🐛 Bug Report

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/assetsRelated to the @aws-cdk/assets packagebugThis issue is a bug.closed-for-stalenessThis issue was automatically closed because it hadn't received any attention in a while.effort/smallSmall work item – less than a day of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions