Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ext/node): apply @npmcli/agent workaround to npm-check-updates #27639

Merged
merged 4 commits into from
Jan 13, 2025

Conversation

kt3k
Copy link
Member

@kt3k kt3k commented Jan 12, 2025

See the comment #25470 (comment) for the reason why we do this workaround to make make-fetch-happen work in Deno

This PR applies the same workaround to npm-check-updates package. npm-check-updates internally uses npm-registry-fetch which uses make-fetch-happen (the problematic package) for making http request to npm registry.

The detection of make-fetch-happen doesn't work for npm-check-updates because we use call stack at net.Socket constructor to check if it's called from make-fetch-happen, but npm-check-updates bundles its dependency and the check doesn't work.

This PR adds the check of npm-check-updates string in call stack in net.Socket constructor to trigger the workaroud.

closes #27629

Copy link
Member

@satyarohith satyarohith left a comment

Choose a reason for hiding this comment

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

LGTM

We need to have a TODO to remove these workarounds.

@kt3k kt3k merged commit 2091691 into denoland:main Jan 13, 2025
17 checks passed
@kt3k kt3k deleted the fix-npm-check-updates-compat branch January 13, 2025 09:11
bartlomieju pushed a commit that referenced this pull request Jan 16, 2025
#27639)

See the comment
#25470 (comment) for
the reason why we do this workaround to make `make-fetch-happen` work in
Deno

This PR applies the same workaround to `npm-check-updates` package.
`npm-check-updates` internally uses
[`npm-registry-fetch`](https://www.npmjs.com/package/npm-registry-fetch)
which uses
[`make-fetch-happen`](https://www.npmjs.com/package/make-fetch-happen)
(the problematic package) for making http request to npm registry.

The detection of `make-fetch-happen` doesn't work for
`npm-check-updates` because we use call stack at `net.Socket`
constructor to check if it's called from `make-fetch-happen`, but
`npm-check-updates` bundles its dependency and the check doesn't work.

This PR adds the check of `npm-check-updates` string in call stack in
net.Socket constructor to trigger the workaroud.

closes #27629
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.

npm-check-updates fails
2 participants