fix: Node profiler crash on init by pinning @datadog/pprof to dd-trace 5.105's required version#783
Merged
Merged
Conversation
purple4reina
approved these changes
Jun 4, 2026
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
Pins three layer-bundled dependencies in package.json to the exact versions/ranges that dd-trace@5.105.0 declares in its optionalDependencies. The important one is @datadog/pprof, which was resolving to a stale
5.13.2 and breaking profiler startup on Node.
Background / root cause
The serverless Node layer bundles whatever scripts/move_ddtrace_dependency.js promotes from devDependencies into dependencies at build time — namely dd-trace, @datadog/pprof, @opentelemetry/api, and @opentelemetry/api-logs. These ship at the top level of the layer's node_modules, so they shadow dd-trace's own nested copies.
@datadog/pprof was declared as "*", which yarn.lock had pinned to 5.13.2. Meanwhile dd-trace@5.105.0 pins @datadog/pprof@5.14.4 in its optionalDependencies. The two versions have an incompatible SourceMapper API:
5.13.2 — only a static SourceMapper.create(searchDirs) factory.
5.14.4 — adds an async loadDirectory(searchDir) instance method.
dd-trace@5.105's profiling/profiler.js calls new
SourceMapper(...).loadDirectory(process.cwd()). Against the hoisted 5.13.2, that throws at profiler startup:The profiler never starts, so the datadog.profiling.agent metric is never emitted. This was caught by the serverless-e2e-tests test_profiling_usage failing for all Node versions after the dd-trace 5.93→5.105
bump.
Changes (package.json devDependencies)
Each value now matches dd-trace@5.105.0's optionalDependencies exactly:
dd-trace itself was already ^5.105.0 and is unchanged.
@opentelemetry/api / api-logs were not actually broken (their "*" already de-duped with dd-trace's ranges to 1.9.0 / 0.208.0), but they're pinned to the same ranges dd-trace declares so the layer can't drift past
dd-trace's supported range in a future install (e.g. pulling otel-api ≥1.10).
yarn.lock is regenerated: the duplicate @datadog/pprof@* (5.13.2) specifier collapses into the single @datadog/pprof@5.14.4 entry.
Verification