aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

Bug: @aws-cdk/aws-cloudformation custom resource provider references resource outside the Asset

Open julienlepine opened this issue 7 years ago • 4 comments

Describe the bug In the following file: packages/@aws-cdk/aws-cloudformation/lib/aws-custom-resource-provider/index.ts, there is a reference to import { AwsSdkCall } from '../aws-custom-resource';

This class is deployed as a custom resource by /packages/@aws-cdk/aws-cloudformation/lib/aws-custom-resource.ts as part of an Asset.

When running a build from a clean environment, the tests don't run.

A clear and concise description of what the bug is.

To Reproduce Remove the content of @aws-cdk/aws-cloudformation/test/cdk.out and run the build, you will have an output of:

test/cdk.out/asset.c55a2043716c67ea5aa695ba9dae511816ddae166121bd37ef197cd34e3f0dcc/index.ts:3:28 - error TS2307: Cannot find module '../aws-custom-resource'.

3 import { AwsSdkCall } from '../aws-custom-resource';
                             ~~~~~~~~~~~~~~~~~~~~~~~~

Expected behavior The ../aws-custom-resource being in the parent folder, it is not included in the Asset created for the aws-custom-resource-provider, and the execution of the function fails as the resource is not in the Asset zip file.

Version:

  • OS: Mac OS X 10.13.6
  • Programming Language: TypeScript
  • CDK Version: 0.34.0

julienlepine avatar Jun 13 '19 15:06 julienlepine

AwsSdkCall is an interface that is imported in the provider's code.

When built, it disappears. See https://unpkg.com/@aws-cdk/[email protected]/lib/aws-custom-resource-provider/ for the content of the folder and provider's code that ships with v0.34.0.

Are you running tsc inside this repo with a cdk.out folder maybe? This can happen if you run the integration tests and then build again.

jogold avatar Jun 13 '19 20:06 jogold

Yes, that is quite possible, I have run build multiple times (initially a build for most modules, then a buildup for another module).

When doing the buildup, tsc must have been run again on the content of cdk.out and failed as the file does not exist in the copied asset.

Possibly having cdk.out as an exclude path in tsconfig.json would solve this. Thoughts?

Julien

Le 13 juin 2019 à 22:25, Jonathan Goldwasser [email protected] a écrit :

AwsSdkCall is an interface that is imported in the provider's code.

When built, it disappears. See https://unpkg.com/@aws-cdk/[email protected]/lib/aws-custom-resource-provider/ for the content of the folder that ships with v0.34.0.

Are you running tsc inside this repo with a cdk.out folder maybe? This can happen if you run the integration tests and then build again.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

julienlepine avatar Jun 14 '19 05:06 julienlepine

OK, then I think it's duplicate of #2835.

jogold avatar Jun 14 '19 07:06 jogold

Absolutely. Closing, thanks for the super fast response.

Closing issue, duplicate of #2835.

julienlepine avatar Jun 14 '19 08:06 julienlepine