evayly
evayly

Reputation: 850

How should files for AWS AssetCode be excluded now?

I used to do this:

    const fn = new lambda.Function(this, "MyLambda", {
      runtime: lambda.Runtime.NODEJS_12_X,
      handler: "index.handler",
      code: lambda.Code.fromAsset(path.join(__dirname, "../lambda"), {
        exclude: ["cdk", "*.ts"],
      }),
    });

But the AWS CDK doc flagged exclude as deprecated without providing a means to replace it. Is there a new mechanism now or should I come up with my own solution (e.g. create a clean folder)?

https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3-assets.AssetOptions.html#excludespan-classapi-icon-api-icon-deprecated-titlethis-api-element-is-deprecated-its-use-is-not-recommended%EF%B8%8Fspan

Upvotes: 1

Views: 1297

Answers (1)

Max Schenkelberg
Max Schenkelberg

Reputation: 855

Nothing you need to do, looks like there is an effort to move assets classes to core. The aws-lambda package uses aws-s3-assets AssetOptions which still uses CopyOptions from assets and not core CopyOptions. Once they do you won't see that warning.

https://github.com/aws/aws-cdk/pull/7708

Upvotes: 1

Related Questions