[core] AssetStaging by bundling ignoring AssetHashType.OUTPUT when doing quick 'skip' hash #11460
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
assetHashType
set toOUTPUT
. Obviously this won't be calculating the correct hash, but I'm not sure what the implication of a different hash is. In any case, I believe the assumption thatSOURCE
hashing is always faster thanOUTPUT
is a wrong assumption.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
)esbuild
or a fake one)time 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 running a very quick bundler and hashing a very small number of output files.Environment
Other
I'm happy to work on this issue, it seems very straight forward enough.
However, combined with its sibling issue #11459 this would just result in removing the
skip
part ofstageByBundling
. I'm wondering if we could just remove random or empty data instead, but I'm not sure ifcdk ls
will rely on any of it.This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: