cdk-pipelines-github icon indicating copy to clipboard operation
cdk-pipelines-github copied to clipboard

Error when customizing the synthetization of the stack

Open clementrey-dev opened this issue 2 years ago • 1 comments

Hello

I have a stack that is deployed with a customize synthetizer. Especially, I am customizing the propertybucketPrefix. I am basically adding a custom prefix to all assets uploaded. While synthesizing, I get the error:


..../node_modules/cdk-pipelines-github/src/pipeline.ts:491
        throw new Error(`Template asset hash ${hash} not found.`);

I have the feeling that the local asset path is not defined correctly. Do you know if there is a workaround ?

Thank you for your help

clementrey-dev avatar Feb 28 '23 22:02 clementrey-dev

Hi @clementrey-dev! Sorry about that, you're almost certainly correct that the custom prefix is the problem here. In cdk-pipelines-github, we use a prop called assetHashMap and the keys of the map are the assetId prior to uploading. We then try to match the asset again using the ID found in the template.

https://github.com/cdklabs/cdk-pipelines-github/blob/b07003f2072a9ac3d0382d4e3b74c5dc418618e6/src/pipeline.ts#L489

I think the solution here is to take into account the custom prefix of an asset before we send it into assetHashMap. We do that here:

https://github.com/cdklabs/cdk-pipelines-github/blob/b07003f2072a9ac3d0382d4e3b74c5dc418618e6/src/pipeline.ts#L428

I can't think of any workaround here. We should fix this in code. That being said, this repo does not get the same maintenance as aws/aws-cdk, and you're mostly at the whim of my availability to get bug fixes in. If this is especially bothersome and you have some extra time, feel free to take a look and see if you can contribute a fix :). Would help me a lot! Otherwise, I'll have this on my radar.

kaizencc avatar Mar 02 '23 15:03 kaizencc