Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,43 @@ RUN rm -rf node_modules
RUN node ./scripts/move_ddtrace_dependency.js "$(cat package.json)" > package-new.json
RUN mv package-new.json package.json
# Install dependencies
RUN yarn install --production=true --ignore-optional
RUN yarn install --production=true
# Copy the dependencies to the modules folder
RUN cp -rf node_modules/* /nodejs/node_modules

# Remove the AWS SDK, which is installed in the lambda by default
RUN rm -rf /nodejs/node_modules/aws-sdk
RUN rm -rf /nodejs/node_modules/aws-xray-sdk-core/node_modules/aws-sdk

# Remove heavy files from dd-trace which aren't used in a lambda environment
RUN rm -rf /nodejs/node_modules/dd-trace/prebuilds
RUN rm -rf /nodejs/node_modules/dd-trace/dist
Comment on lines +35 to +36

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure where these come from. They do not belong to dd-trace (if they did, they do not since a very long time).

RUN rm -rf /nodejs/node_modules/@datadog/libdatadog
RUN rm -rf /nodejs/node_modules/@datadog/native-appsec
RUN rm -rf /nodejs/node_modules/@datadog/native-metrics
RUN rm -rf /nodejs/node_modules/hdr-histogram-js/build
RUN rm -rf /nodejs/node_modules/protobufjs/dist
RUN rm -rf /nodejs/node_modules/protobufjs/cli
Comment on lines +40 to +42

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be changed to match our vendored path in dd-trace.

RUN rm -rf /nodejs/node_modules/@datadog/pprof/prebuilds/linux-arm
RUN rm -rf /nodejs/node_modules/@datadog/pprof/prebuilds/darwin-arm64
RUN rm -rf /nodejs/node_modules/@datadog/pprof/prebuilds/darwin-x64
RUN rm -rf /nodejs/node_modules/@datadog/pprof/prebuilds/win32-ia32
RUN rm -rf /nodejs/node_modules/@datadog/pprof/prebuilds/win32-x64

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RUN rm -rf /nodejs/node_modules/@datadog/native-iast-taint-tracking
RUN rm -rf /nodejs/node_modules/@datadog/native-iast-rewriter
RUN rm -rf /nodejs/node_modules/@datadog/pprof/prebuilds/linuxmusl-x64
RUN rm -rf /nodejs/node_modules/jsonpath-plus/src/jsonpath.d.ts
RUN rm -rf /nodejs/node_modules/jsonpath-plus/src/jsonpath-browser.js
RUN rm -rf /nodejs/node_modules/jsonpath-plus/src/dist/index-browser-umd.min.cjs
RUN rm -rf /nodejs/node_modules/jsonpath-plus/src/dist/index-browser-umd.cjs
RUN rm -rf /nodejs/node_modules/jsonpath-plus/src/dist/index-browser-esm.min.js
RUN rm -rf /nodejs/node_modules/jsonpath-plus/src/dist/index-browser-esm.js
Comment on lines +51 to +56

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be changed to match our vendored path in dd-trace.

Copy link
Contributor Author

@ojproductions ojproductions Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

theres only an index.js file in each vendored package, so these files wouldnt exist there either. I think its okay to just remove these lines

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, vendoring should remove the need for any removal in a vendored dependency.

RUN find /nodejs/node_modules -name "*.d.ts" -delete
RUN find /nodejs/node_modules -name "*.js.map" -delete
RUN find /nodejs/node_modules -name "*.mjs.map" -delete
RUN find /nodejs/node_modules -name "*.cjs.map" -delete
RUN find /nodejs/node_modules -name "*.ts.map" -delete
RUN find /nodejs/node_modules -name "*.md" -delete

FROM scratch
COPY --from=builder /nodejs /
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@types/node": "^20.12.10",
"@types/promise-retry": "^1.1.3",
"@types/shimmer": "^1.0.1",
"dd-trace": "^5.82.0",
"dd-trace": "^5.83.0",
"jest": "^27.0.1",
"mock-fs": "4.14.0",
"nock": "13.5.4",
Expand Down
47 changes: 26 additions & 21 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1186,10 +1186,10 @@
"@datadog/flagging-core" "0.2.0"
"@openfeature/server-sdk" "~1.18.0"

"@datadog/[email protected].1":
version "5.13.1"
resolved "https://registry.yarnpkg.com/@datadog/pprof/-/pprof-5.13.1.tgz#51c540d75cf4471806db65d0686cbe0a96125ce2"
integrity sha512-7yXQco1xOUFFEHN3UsRw/55603lQTctHcGx9N7PgkcgLGL8t/i5qKalF0AhOKBsLBUnbQ9Iv+ecC2YJErJ07PQ==
"@datadog/[email protected].2":
version "5.13.2"
resolved "https://registry.yarnpkg.com/@datadog/pprof/-/pprof-5.13.2.tgz#9361809e712417e04c21e7f7ea239bfb3513c358"
integrity sha512-Th8u7pvoguTfbUx/mlZLHD9TxFCHO+wRAvlEaYFAYAmMvbPLww4YowvTy1UMvpi8LbUbwil3Fo8rKCrilvXHhQ==
dependencies:
delay "^5.0.0"
node-gyp-build "<4.0"
Expand Down Expand Up @@ -2339,9 +2339,9 @@ acorn@^7.1.1:
resolved "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz"
integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==

acorn@^8.14.0, acorn@^8.2.4:
acorn@^8.15.0, acorn@^8.2.4:
version "8.15.0"
resolved "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.15.0.tgz#a360898bc415edaac46c8241f6383975b930b816"
integrity sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==

agent-base@6:
Expand Down Expand Up @@ -2638,11 +2638,16 @@ ci-info@^3.2.0:
resolved "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz"
integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==

cjs-module-lexer@^1.0.0, cjs-module-lexer@^1.2.2:
cjs-module-lexer@^1.0.0:
version "1.4.1"
resolved "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.4.1.tgz"
integrity sha512-cuSVIHi9/9E/+821Qjdvngor+xpnlwnuwIyZOaLmHBVdXL+gP+I6QQB9VkO7RI77YIcTV+S1W9AreJ5eN63JBA==

cjs-module-lexer@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-2.2.0.tgz#b3ca5101843389259ade7d88c77bd06ce55849ca"
integrity sha512-4bHTS2YuzUvtoLjdy+98ykbNB5jS0+07EvFNXerqZQJ89F7DI6ET7OQo/HJuW6K0aVsKA9hj9/RVb2kQVOrPDQ==

cliui@^7.0.2:
version "7.0.4"
resolved "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz"
Expand Down Expand Up @@ -2758,20 +2763,20 @@ dc-polyfill@^0.1.3:
resolved "https://registry.npmjs.org/dc-polyfill/-/dc-polyfill-0.1.9.tgz"
integrity sha512-D5mJThEEk9hf+CJPwTf9JFsrWdlWp8Pccjxkhf7uUT/E/cU9Mx3ebWe2Bz2OawRmJ6WS9eaDPBkeBE4uOKq9uw==

dd-trace@^5.82.0:
version "5.82.0"
resolved "https://registry.yarnpkg.com/dd-trace/-/dd-trace-5.82.0.tgz#00f3d71b66debf1e5326cdf415c9b039fecf7158"
integrity sha512-syHzhuQw6USxnAdaNho3BhAz4c3L3Ze79WJXiBAE28WRn6JZuyrYkTKT9+FKvCtK0eyDCx5zCjApohl1BIB0uA==
dd-trace@^5.83.0:
version "5.83.0"
resolved "https://registry.yarnpkg.com/dd-trace/-/dd-trace-5.83.0.tgz#3f641c512c7f140d2b85cc7709b45aa2cf3f2787"
integrity sha512-12seR3wGc5Wp+NAHBO6gShCtg8wz0+p+rC6tc3G5MrSgowMqV0XdNqahOHqeM8kMRmSy1OnWRQcK8xjxVfnsew==
dependencies:
dc-polyfill "^0.1.10"
import-in-the-middle "2.0.0"
import-in-the-middle "2.0.3"
optionalDependencies:
"@datadog/libdatadog" "0.7.0"
"@datadog/native-appsec" "10.3.0"
"@datadog/native-iast-taint-tracking" "4.1.0"
"@datadog/native-metrics" "3.1.1"
"@datadog/openfeature-node-server" "^0.2.0"
"@datadog/pprof" "5.13.1"
"@datadog/pprof" "5.13.2"
"@datadog/wasm-js-rewriter" "5.0.1"
"@opentelemetry/api" ">=1.0.0 <1.10.0"
"@opentelemetry/api-logs" "<1.0.0"
Expand Down Expand Up @@ -3238,15 +3243,15 @@ ieee754@^1.1.4:
resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz"
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==

[email protected].0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/import-in-the-middle/-/import-in-the-middle-2.0.0.tgz#295948cee94d0565314824c6bd75379d13e5b1a5"
integrity sha512-yNZhyQYqXpkT0AKq3F3KLasUSK4fHvebNH5hOsKQw2dhGSALvQ4U0BqUc5suziKvydO5u5hgN2hy1RJaho8U5A==
[email protected].3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/import-in-the-middle/-/import-in-the-middle-2.0.3.tgz#2ba36d716faa3531a7946c4ee52a8e553f6ee0bd"
integrity sha512-BhJ3Rc6x+kA3EE0apAuGc4rsihsUrEj31lCkXRfwGzLKqgzlSyBLvthIinsvLg6J4bCCTgVAoAgD+KwkISjmBQ==
dependencies:
acorn "^8.14.0"
acorn "^8.15.0"
acorn-import-attributes "^1.9.5"
cjs-module-lexer "^1.2.2"
module-details-from-path "^1.0.3"
cjs-module-lexer "^2.2.0"
module-details-from-path "^1.0.4"

import-local@^3.0.2:
version "3.2.0"
Expand Down Expand Up @@ -4000,7 +4005,7 @@ [email protected]:
resolved "https://registry.npmjs.org/mock-fs/-/mock-fs-4.14.0.tgz"
integrity sha512-qYvlv/exQ4+svI3UOvPUpLDF0OMX5euvUH0Ny4N5QyRyhNdgAgUrVH3iUINSzEPLvx0kbo/Bp28GJKIqvE7URw==

module-details-from-path@^1.0.3:
module-details-from-path@^1.0.3, module-details-from-path@^1.0.4:
version "1.0.4"
resolved "https://registry.npmjs.org/module-details-from-path/-/module-details-from-path-1.0.4.tgz"
integrity sha512-EGWKgxALGMgzvxYF1UyGTy0HXX/2vHLkw6+NvDKW2jypWbHpjQuj4UMcqQWXHERJhVGKikolT06G3bcKe4fi7w==
Expand Down
Loading