[core] AssetStaging by bundling not using custom assetHash when doing quick 'skip' hash #11459
Labels
@aws-cdk/core
Related to core CDK functionality
bug
This issue is a bug.
in-progress
This issue is being actively worked on.
needs-triage
This issue or PR still needs to be triaged.
AssetStaging
provides a shortcut when using custom bundling interface which allows toskip
the normal hashing method. Instead it falls back toAssetHashType.SOURCE
with a comment implying it would be quicker. This code path seems to be only invoked whencdk list
is called, but I might have misunderstood the condition.Code Reference:
aws-cdk/packages/@aws-cdk/core/lib/asset-staging.ts
Lines 240 to 248 in 21ccfce
This shortcut is also taken when a custom assetHash is provided and
assetHashType
set toCUSTOM
.Besides from calculating a different hash, fingerprinting source files will always be slower than using a pre-computed hash.
Reproduction Steps
Apologies for not providing a code sample at this point. But it can be recreated with a simple setup:
S3.Asset
to a stack pointing to a large folder (e.g. one that contains a lot ofnode_modules
)assetHash
and typetime cdk synth
, then runtime cdk ls
What did you expect to happen?
cdk ls
should be quicker or at leat taking the same time ascdk synth
.What actually happened?
cdk ls
takes significantly longer thancdk synth
, since calculating the assetHash from a large source takes much longer than using a pre-provided hash.Environment
Other
This is related to the sibling issue: #11460 : [core] AssetStaging by bundling ignoring
AssetHashType.OUTPUT
when doing quick 'skip' hashI'm happy to work on this issue, it seems very straight forward. However as pointed out in the other issue there might be a more generic or better solution to it.
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: