Skip to content

Conversation

@overbalance
Copy link
Contributor

@overbalance overbalance commented Sep 10, 2025

What this does

Hoists all build devDependencies to the root package.json.

  • 14 fewer packages in node_modules (1.13% reduction)
  • 878 fewer in dependency tree (11.39% reduction)
  • 304 fewer packages added by npm ci (10.44% reduction)

Key changes

Test fixes

  • Updated karma configs to load plugins from root after dependency hoisting
  • Fixed webpack process polyfill path for ESM compatibility
  • Updated expect import syntax for socket.io tests
  • Updated AWS SDK mock response Content-Length headers

Dependencies

  • All build devDependencies moved to root package.json
  • Removed unused jQuery dependencies

Configuration

  • Converted root .mocharc.yml to .mocharc.json
  • Fixed axios import syntax in express example (namespace import → default import)

Package-specific changes

@opentelemetry/instrumentation-socket.io

  • Changed import * as expect to import expect (expect v29 uses default export)

@opentelemetry/instrumentation-dns

@opentelemetry/instrumentation-aws-sdk

  • Updated Bedrock mock response Content-Length headers

Browser packages (propagator-aws-xray, propagator-instana, instrumentation-user-interaction, instrumentation-long-task)

  • Updated karma.conf.js to load plugins from root package.json

@overbalance overbalance force-pushed the overbalance/hoist-all-shared-deps branch 4 times, most recently from 4797803 to 723401a Compare October 8, 2025 14:40
@overbalance overbalance requested a review from trentm October 8, 2025 14:48
@overbalance overbalance force-pushed the overbalance/hoist-all-shared-deps branch from 723401a to 3056842 Compare October 10, 2025 06:05
@overbalance overbalance changed the title build: hoist all devDeps to root, fix CommonJS module resolution build: hoist all devDeps to root Oct 10, 2025
@overbalance
Copy link
Contributor Author

overbalance commented Oct 10, 2025

@trentm If Node 18 support is needed then there's more work to do. I missed this requirement when I started this work. 😕 How do you want to proceed? Try to roll back dependency versions until it's happy?

❯ npm ci
npm warn EBADENGINE Unsupported engine {
npm warn EBADENGINE   package: '@azure-rest/[email protected]',
npm warn EBADENGINE   required: { node: '>=20.0.0' },
npm warn EBADENGINE   current: { node: 'v18.20.8', npm: '10.8.2' }
npm warn EBADENGINE }
npm warn EBADENGINE Unsupported engine {
npm warn EBADENGINE   package: '@azure/[email protected]',
npm warn EBADENGINE   required: { node: '>=20.0.0' },
npm warn EBADENGINE   current: { node: 'v18.20.8', npm: '10.8.2' }
npm warn EBADENGINE }

@overbalance overbalance force-pushed the overbalance/hoist-all-shared-deps branch from 3056842 to 804aa71 Compare October 13, 2025 16:19
@JamieDanielson
Copy link
Member

@trentm If Node 18 support is needed then there's more work to do. I missed this requirement when I started this work. 😕 How do you want to proceed? Try to roll back dependency versions until it's happy?

🤔 We say we support Active and Maintenance LTS versions of Node, and Node 18 is officially end of life. So it might be fine in Contrib to drop support for 18. That's a bigger discussion though (cc @open-telemetry/javascript-maintainers ) and we'll need to update docs too.

@trentm
Copy link
Contributor

trentm commented Oct 15, 2025

If Node 18 support is needed then there's more work to do. I missed this requirement when I started this work. 😕 How do you want to proceed? Try to roll back dependency versions until it's happy?

❯ npm ci
npm warn EBADENGINE Unsupported engine {

@overbalance I don't think those EBADENGINE warnings are blocking for this PR. We already have a number of those warnings in the current state. Unfortunately an EBADENGINE warning will matter for some deps, but not for some deps that are just for testing. For example this one:

npm warn EBADENGINE Unsupported engine {
npm warn EBADENGINE   package: '@azure/[email protected]',
npm warn EBADENGINE   required: { node: '>=20.0.0' },
npm warn EBADENGINE   current: { node: 'v18.20.8', npm: '10.8.2' }
npm warn EBADENGINE }

That dep is used by tedious@17:

% npm ls @azure/core-auth
[email protected] /Users/trentm/src/opentelemetry-js-contrib
└─┬ @opentelemetry/[email protected] -> ./packages/instrumentation-tedious
  └─┬ [email protected]
    ├─┬ @azure/[email protected]
    │ ├── @azure/[email protected]
    │ ├─┬ @azure/[email protected]
    │ │ └── @azure/[email protected] deduped
    │ └─┬ @azure/[email protected]
    │   └── @azure/[email protected] deduped
    └─┬ @azure/[email protected]
      ├─┬ @azure-rest/[email protected]
      │ └── @azure/[email protected] deduped
      ├── @azure/[email protected] deduped
      └─┬ @azure/[email protected]
        └── @azure/[email protected] deduped

which is a test dep. We intentionally install a recent-ish major version of tedious so that unit tests (i.e. npm test) for an instrumentation (instrumentation-tedious in this case) tests with a relatively modern version of the target package. We then rely on our test-all-versions tests to handle testing against those versions of tedious that work with older Node.js versions (e.g. Node.js v18)

@overbalance overbalance force-pushed the overbalance/hoist-all-shared-deps branch from 46672a0 to 6ac6dbd Compare October 15, 2025 17:24
@overbalance overbalance changed the title build: hoist all devDeps to root refactor: hoist all devDeps to root Oct 15, 2025
@overbalance
Copy link
Contributor Author

@trentm Those warnings are blocking CI from what I see. What do you recommend?

@trentm
Copy link
Contributor

trentm commented Oct 17, 2025

Those warnings are blocking CI from what I see.

I don't know what is going on. I can npm ci this feature branch locally.

This CI step failed with a network error: https://github.com/open-telemetry/opentelemetry-js-contrib/actions/runs/18537223726/job/53057847496?pr=3032

...
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '20 || >=22' },
npm WARN EBADENGINE   current: { node: 'v18.19.0', npm: '10.2.3' }
npm WARN EBADENGINE }
npm ERR! code ECONNRESET
npm ERR! network aborted
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in: /home/runner/.npm/_logs/2025-10-17T23_04_44_742Z-debug-0.log
Error: Process completed with exit code 1.

The other test jobs are stuck in npm ci. I cancelled the run after 20m.
I think the "network aborted" above is just a fluke. The real issue is the stuck npm ci steps.

The lint workflow, which does npm ci --ignore-scripts, worked fine.

Ideas on what this could be:

  • Some install/build/postinstall script in one of the deps is breaking things.
  • Some GitHub Actions or npmjs bug/incident that is causing this to break.
  • Some limit is being hit in GH Actions? THis is total guess.

@overbalance overbalance force-pushed the overbalance/hoist-all-shared-deps branch 3 times, most recently from 99cc06d to 324495b Compare October 21, 2025 20:36
@overbalance overbalance force-pushed the overbalance/hoist-all-shared-deps branch 2 times, most recently from 469663e to 9cb3aef Compare October 29, 2025 15:24
trentm pushed a commit that referenced this pull request Oct 29, 2025
... because we are seeing hangs in `npm ci` on #3032.
@overbalance overbalance force-pushed the overbalance/hoist-all-shared-deps branch from 9cb3aef to 2d57789 Compare October 29, 2025 18:46
@overbalance overbalance force-pushed the overbalance/hoist-all-shared-deps branch 2 times, most recently from 6c35007 to 6fce51c Compare October 30, 2025 04:49
@overbalance overbalance force-pushed the overbalance/hoist-all-shared-deps branch from 6fce51c to 6e7f06f Compare October 30, 2025 05:12
@overbalance
Copy link
Contributor Author

@trentm I repaired the lockfile and this is finally 🟢. Thanks for your help.

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

Labels

has:sponsor This package or feature has a sponsor that has volunteered to review PRs and respond to questions pkg:auto-configuration-propagators pkg:auto-instrumentations-node pkg:auto-instrumentations-web pkg:host-metrics pkg:id-generator-aws-xray pkg:instrumentation-amqplib pkg:instrumentation-aws-lambda pkg:instrumentation-aws-sdk pkg:instrumentation-bunyan pkg:instrumentation-cassandra-driver pkg:instrumentation-connect pkg:instrumentation-cucumber pkg:instrumentation-dataloader pkg:instrumentation-dns pkg:instrumentation-document-load pkg:instrumentation-express pkg:instrumentation-fastify pkg:instrumentation-fs pkg:instrumentation-generic-pool pkg:instrumentation-graphql pkg:instrumentation-hapi pkg:instrumentation-ioredis pkg:instrumentation-kafkajs pkg:instrumentation-knex pkg:instrumentation-koa pkg:instrumentation-long-task pkg:instrumentation-lru-memoizer pkg:instrumentation-memcached pkg:instrumentation-mongodb pkg:instrumentation-mongoose pkg:instrumentation-mysql pkg:instrumentation-mysql2 pkg:instrumentation-nestjs-core pkg:instrumentation-net pkg:instrumentation-openai pkg:instrumentation-oracledb pkg:instrumentation-pg pkg:instrumentation-pino pkg:instrumentation-redis pkg:instrumentation-restify pkg:instrumentation-router pkg:instrumentation-runtime-node pkg:instrumentation-socket.io pkg:instrumentation-tedious pkg:instrumentation-undici pkg:instrumentation-user-interaction pkg:instrumentation-winston pkg:plugin-react-load pkg:propagation-utils pkg:propagator-aws-xray pkg:propagator-aws-xray-lambda pkg:propagator-instana pkg:propagator-ot-trace pkg:redis-common pkg:resource-detector-alibaba-cloud pkg:resource-detector-aws pkg:resource-detector-azure pkg:resource-detector-container pkg:resource-detector-gcp pkg:resource-detector-github pkg:resource-detector-instana pkg:sampler-aws-xray pkg:sql-common pkg:test-utils pkg-status:unmaintained:autoclose-scheduled pkg-status:unmaintained This package is unmaintained. Only bugfixes may be acceped until a new owner has been found.

Projects

None yet

Development

Successfully merging this pull request may close these issues.