fix(layers): bundle all publishable utilities in the Lambda layer - #5577
Open
svozza wants to merge 2 commits into
Open
fix(layers): bundle all publishable utilities in the Lambda layer#5577svozza wants to merge 2 commits into
svozza wants to merge 2 commits into
Conversation
The layer bundled a hardcoded list of 10 packages, omitting the published data-masking, signer, kafka, and validation utilities. Derive the list from the workspace instead — every non-private @aws-lambda-powertools/* package under packages/ — so new utilities are bundled automatically and the list can't silently drift. The e2e function now imports and exercises the newly-bundled utilities to prove they load from the layer, and its version-parity check reads the layer directory rather than a hardcoded list. Closes #5576
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Lambda layer bundled a hardcoded list of 10 packages, silently omitting the
published
data-masking,signer,kafka, andvalidationutilities.Customers relying on the layer alone hit module-not-found errors for those
features. This derives the bundled list from the workspace so the four missing
utilities are included and any future utility is bundled automatically, without
the list drifting out of sync.
Changes
layers/src/layer-publisher-stack.ts: replace the hardcodedutilitiesarray withgetLayerUtilities(), which scanspackages/*/package.jsonand keeps every non-private@aws-lambda-powertools/*package; both the published-install andbuildFromLocalpaths now key off the derived package name / workspace dir. AddspackTarballPrefix()and an empty-list guard.layers/tests/e2e/layerPublisher.class.test.functionCode.ts: import and exercise the four newly-bundled utilities (DataMasking.erase,validate,kafkaConsumer,SigV4Signer) so the E2E proves they load from the layer; read the layer's@aws-lambda-powertools/directory for the version-parity check instead of a hardcoded list.layers/tests/unit/layer-publisher.test.ts: assert the locally-bundled layer contains every derived utility and excludes the privatetesting-utils.layers/tests/unit/getLayerUtilities.test.ts(new): pure tests for the helpers, including asserting the real workspace resolves to exactly the 14 public packages.Testing
biome ciandtsc --noEmitclean.@aws-sdk/*client shipped (only the types-only@aws-sdk/types), preserving the fix(layers): do not ship AWS SDK clients in the Lambda layer #5512 invariant;@aws-crypto/client-nodecorrectly absent (optional peer).layers/tests/e2e/layerPublisher.test.ts8/8 passed — published a live layer, deployed and invoked CJS and ESM functions on it exercising all four new utilities, then auto-torn-down with no leftover stacks.Issue number: closes #5576
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.