Bug: @aws-cdk/aws-cloudformation custom resource provider references resource outside the Asset
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
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.
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.
OK, then I think it's duplicate of #2835.
Absolutely. Closing, thanks for the super fast response.
Closing issue, duplicate of #2835.