Skip to content

Conversation

@samchungy
Copy link
Contributor

@samchungy samchungy commented Nov 25, 2025

What does this PR do?

  • Declare @aws-sdk/client-secrets-manager as an optional peer dep

Motivation

One of our team ran into:

Bundling asset appStack/worker/Code/Stage...
✘ [ERROR] Could not resolve "@aws-sdk/client-secrets-manager"

    node_modules/.pnpm/[email protected]/node_modules/datadog-lambda-js/dist/metrics/listener.js:296:110:
      296 │                         return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require("@aws-sdk/client-secrets-manager")); })];
          ╵                                                                                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@aws-sdk/client-secrets-manager" as external to exclude it from the bundle,
  which will remove this error and leave the unresolved path in the bundle. You can also surround
  this "require" call with a try/catch block to handle this failure at run-time instead of
  bundle-time.

1 error
node:child_process:954
    throw err;
    ^

There's nothing which explicitly tells you to install this so we should probably declare it as an optional peer dependency so consumers who aren't using bundlers can at least know they're missing a dep? Or are we relying on the lambda runtime to bring it in?

Testing Guidelines

N/A

Additional Notes

N/A

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)

@samchungy samchungy marked this pull request as ready for review November 25, 2025 03:21
@samchungy samchungy requested review from a team as code owners November 25, 2025 03:21
@purple4reina
Copy link
Contributor

@samchungy Thanks for opening this. As you alluded to, the lambda runtime provides all of the aws sdk packages by default. Customers shouldn't need to package them into their lambdas manually.

Instead, you should mark all of @aws-sdk/* as an external package. This way, it will not be bundled in with your lambda code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants