fix: mount dd-trace-js local volume as rw for nodejs-load-from-local#6716
Draft
dd-oleksii wants to merge 2 commits intomainfrom
Draft
fix: mount dd-trace-js local volume as rw for nodejs-load-from-local#6716dd-oleksii wants to merge 2 commits intomainfrom
dd-oleksii wants to merge 2 commits intomainfrom
Conversation
When using `nodejs-load-from-local`, the dd-trace-js repo was mounted into the container as read-only (`ro`). At startup, `app.sh` runs `npm link` inside `/volumes/dd-trace-js` to wire the local tracer into the weblog. `npm link` executes the package's `prepare` lifecycle script (in dd-trace-js: `cd vendor && npm ci --include=dev`), which needs to write to the source directory. `npm ci` always performs a clean reinstall — it removes the existing `node_modules` before reinstalling — so it requires write access even if `vendor/node_modules` is already present. The `ro` mount made this impossible, causing an `EROFS: read-only file system` error and the weblog container to exit immediately. Notably, `npm link --ignore-scripts` does not fix this: npm v7+ runs `prepare` scripts unconditionally during local linking, regardless of the `--ignore-scripts` flag. The fix is to mount the volume as `rw`. This is appropriate because `npm link` is inherently a write operation on the source directory — the same writes (`vendor/node_modules`) would occur if the user ran `npm install` locally. Unlike the Python `load-from-local` approach (which only reads sources via `PYTHONPATH`), Node.js local linking requires the package to be built in-place.
Contributor
|
|
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🔗 Commit SHA: d50be75 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
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.
When using
nodejs-load-from-local, the dd-trace-js repo was mounted into the container as read-only (ro). At startup,app.shrunsnpm linkinside/volumes/dd-trace-jsto wire the local tracer into the weblog.npm linkexecutes the package'spreparelifecycle script (in dd-trace-js:cd vendor && npm ci --include=dev), which needs to write to the source directory.npm cialways performs a clean reinstall — it removes the existingnode_modulesbefore reinstalling — so it requires write access even ifvendor/node_modulesis already present. Theromount made this impossible, causing anEROFS: read-only file systemerror and the weblog container to exit immediately.Notably,
npm link --ignore-scriptsdoes not fix this: npm v7+ runspreparescripts unconditionally during local linking, regardless of the--ignore-scriptsflag.The fix is to mount the volume as
rw. This is appropriate becausenpm linkis inherently a write operation on the source directory — the same writes (vendor/node_modules) would occur if the user rannpm installlocally. Unlike the Pythonload-from-localapproach (which only reads sources viaPYTHONPATH), Node.js local linking requires the package to be built in-place.Motivation
Changes
Workflow
🚀 Once your PR is reviewed and the CI green, you can merge it!
🛟 #apm-shared-testing 🛟
Reviewer checklist
tests/ormanifests/is modified ? I have the approval from R&P teambuild-XXX-imagelabel is present