Skip to content

Release/v12.139.0#781

Merged
joeyzhao2018 merged 4 commits into
mainfrom
release/v12.139.0
Jun 3, 2026
Merged

Release/v12.139.0#781
joeyzhao2018 merged 4 commits into
mainfrom
release/v12.139.0

Conversation

@joeyzhao2018
Copy link
Copy Markdown
Contributor

@joeyzhao2018 joeyzhao2018 commented Jun 1, 2026

The datadog-lambda-js/package.json is not included in our layers, because the layer build only copies dist there in Dockerfile (line 15).

What changed in dd-trace@5.105.0 is the hook wrapper behavior:

moduleVersion ||= getVersion(moduleBaseDir)

getVersion() calls requirePackageJson(moduleBaseDir, module). For this layer, moduleBaseDir is effectively:
/opt/nodejs/node_modules/datadog-lambda-js

  1. MetricsListener.createProcessor() calls require("./api") in src/metrics/listener.ts (line 146).
  2. dd-trace’s require hook sees this as an internal file under the instrumented package datadog-lambda-js. Before letting the lambda hook decide whether to patch it, dd-trace@5.105.0 tries to read datadog-lambda-js/package.json, which fails.
  3. The hook returns undefined. Therefore require("./api") becomes undefined, and destructuring { APIClient } throws.

dd-trace@5.93.0 did not care in this path. Its hook wrapper did not try to read the target package’s package.json before returning module exports. So for datadog-lambda-js/metrics/api.js it just passed the real module exports through

@joeyzhao2018 joeyzhao2018 requested review from a team as code owners June 1, 2026 17:05
@datadog-datadog-prod-us1-2

This comment has been minimized.

@joeyzhao2018 joeyzhao2018 merged commit d8b3493 into main Jun 3, 2026
41 of 42 checks passed
@joeyzhao2018 joeyzhao2018 deleted the release/v12.139.0 branch June 3, 2026 17:52
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