Skip to content

Maintenance: Lambda layer does not bundle all published utilities (data-masking, signer, kafka, validation) #5576

Description

@svozza

Summary

The published Lambda layer bundles only 10 of the 14 public @aws-lambda-powertools/* utilities. The hardcoded utilities array in layers/src/layer-publisher-stack.ts (lines 107-118) omits four utilities that are published to npm:

validation and kafka predate the last update to the layer list (#4956, which added event-handler); data-masking and signer came afterward. None were ever appended. @aws-lambda-powertools/testing-utils is private: true and is correctly excluded.

Why is this needed?

Customers using the layer cannot import these utilities without installing them separately — the modules are simply absent from /opt/nodejs/node_modules, so a function relying on the layer alone fails at runtime with a module-not-found error. Beyond fixing the four missing packages, the hardcoded list is a recurring drift hazard: it has silently fallen behind the workspace four times already.

Which area does this relate to?

Other (Lambda layer publishing / layers/)

Solution

Rather than adding the four names to the hardcoded list (which will drift again the next time a utility is added), derive the layer contents from the workspace: scan packages/*/package.json and bundle every non-private @aws-lambda-powertools/* package. This bundles the four missing utilities today and any future utility automatically.

Touch points:

  • layers/src/layer-publisher-stack.ts — replace the hardcoded utilities array with a scan of packages/, filtering private: true. The published-install path (<name>@<version>), the buildFromLocal build/pack path (-w packages/<dir>), and the npm pack tarball naming all need to key off the derived package name/dir rather than an assumed short name.
  • layers/tests/e2e/layerPublisher.class.test.functionCode.ts (lines 89-99) — the version-parity check has the same hardcoded list (also missing jmespath). Make it iterate the layer's @aws-lambda-powertools/ directory so it verifies whatever actually shipped.

Considerations to review during implementation:

  • validation pulls in ajv@^8 → increases layer size (jmespath, its other dep, is already bundled).
  • data-masking declares @aws-crypto/client-node as an optional peer, so it won't be installed by default. Decide whether to ship a crypto backend in the layer or leave it to the customer (consistent with the "we don't ship AWS SDK clients" policy from fix(layers): do not ship AWS SDK clients in the Lambda layer #5512).
  • kafka optional peers are arktype/valibot/zod; zod is already installed in the layer, the others are optional and not bundled.
  • signer adds @smithy/* packages (small).
  • Auto-derivation means any newly-added public package ships in the layer without an explicit opt-in — acceptable given all 14 current public packages are intended to ship, but worth noting.

Activity

  1. added
    triageThis item has not been triaged by a maintainer, please wait
    internalPRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)
    on Aug 23, 2026
  2. added a commit that references this issue on Aug 23, 2026
    8425915
  3. self-assigned this
    on Aug 23, 2026
  4. removed
    triageThis item has not been triaged by a maintainer, please wait
    on Aug 24, 2026
  5. powertools-for-aws-oss-automation commented on Aug 26, 2026

    @powertools-for-aws-oss-automation

    Warning

    This issue is now closed. Please be mindful that future comments are hard for our team to see.
    If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
    If you wish to keep having a conversation with other community members under this issue feel free to do so.

  6. removed
    internalPRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)
    on Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions