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

Wrong Host-header is being used for retrieving libvips from GitHub #3654

Closed
3 tasks done
TomWis97 opened this issue May 2, 2023 · 2 comments
Closed
3 tasks done

Wrong Host-header is being used for retrieving libvips from GitHub #3654

TomWis97 opened this issue May 2, 2023 · 2 comments

Comments

@TomWis97
Copy link
Contributor

TomWis97 commented May 2, 2023

Possible install-time or require-time problem

  • I have read the documentation relating to installation.
  • I have ensured that the architecture and platform of Node.js used for npm install is the same as the architecture and platform of Node.js used at runtime.

Are you using the latest version of sharp?

  • I am using the latest version of sharp as reported by npm view sharp dist-tags.latest.

If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.

If you are using another package which depends on a version of sharp that is not the latest, please open an issue against that package instead.

Is this a problem with filesystem permissions?

If you are using npm v6 or earlier and installing as a root or sudo user, have you tried with the npm install --unsafe-perm flag?

If you are using npm v7 or later, does the user running npm install own the directory it is run in?

If you are using the ignore-scripts feature of npm, have you tried with the npm install --ignore-scripts=false flag?

What is the complete output of running npm install --verbose --foreground-scripts sharp in an empty directory?

root@c60302cc9514:/tmp# npm install [email protected] --verbose --foreground-scripts
npm verb cli /usr/local/bin/node /usr/local/bin/npm
npm info using [email protected]
npm info using [email protected]
npm verb title npm install [email protected]
npm verb argv "install" "[email protected]" "--loglevel" "verbose" "--foreground-scripts"
npm verb logfile logs-max:10 dir:/root/.npm/_logs/2023-05-02T14_26_16_771Z-
npm verb logfile /root/.npm/_logs/2023-05-02T14_26_16_771Z-debug-0.log
npm http fetch GET 200 https://registry.npmjs.org/sharp 14ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/detect-libc 22ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/tar-fs 26ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/prebuild-install 29ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/tunnel-agent 28ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/semver 30ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/node-addon-api 32ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/simple-get 32ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/color 37ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/expand-template 38ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/color-convert 41ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/github-from-package 40ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/mkdirp-classic 40ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/minimist 40ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/napi-build-utils 40ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/lru-cache 40ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/color-string 47ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/rc 52ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/pump 54ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/chownr 50ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/node-abi 55ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/once 54ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/simple-concat 54ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/mkdirp-classic 53ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/decompress-response 56ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/tar-stream 53ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/safe-buffer 54ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/color-name 6ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/color-name 8ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/simple-swizzle 8ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/is-arrayish 3ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/end-of-stream 9ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/strip-json-comments 8ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/ini 8ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/deep-extend 10ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/wrappy 6ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/yallist 4ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/mimic-response 3ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/inherits 14ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/fs-constants 15ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/bl 16ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/readable-stream 15ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/util-deprecate 10ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/string_decoder 11ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/buffer 13ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/base64-js 12ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/ieee754 13ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/sharp/-/sharp-0.32.1.tgz 206ms (cache miss)
npm info run [email protected] install node_modules/sharp (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)

[email protected] install
(node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)

sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.14.2/libvips-8.14.2-linux-x64.tar.brnstall/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
sharp: Via proxy http://proxy-az1.REDACTED:8080 no credentials
sharp: Installation error: tunneling socket could not be established, statusCode=503 (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
npm info run [email protected] install { code: 1, signal: null }
npm verb stack Error: command failed
npm verb stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27)
npm verb stack at ChildProcess.emit (node:events:513:28)
npm verb stack at maybeClose (node:internal/child_process:1091:16)
npm verb stack at ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm verb pkgid [email protected]
npm verb cwd /tmp
npm verb Linux 5.11.0-27-generic
npm verb node v18.15.0
npm verb npm v9.5.0
npm ERR! code 1
npm ERR! path /tmp/node_modules/sharp
npm ERR! command failed
npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm verb exit 1
npm verb unfinished npm timer reify 1683037576812
npm verb unfinished npm timer reify:build 1683037577348
npm verb unfinished npm timer build 1683037577349
npm verb unfinished npm timer build:deps 1683037577349
npm verb unfinished npm timer build:run:install 1683037577354
npm verb unfinished npm timer build:run:install:node_modules/sharp 1683037577354
npm verb code 1

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2023-05-02T14_26_16_771Z-debug-0.log

What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?

System:
OS: Linux 5.11 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
CPU: (4) x64 AMD EPYC 7542 32-Core Processor
Memory: 11.75 GB / 15.60 GB
Container: Yes
Shell: 5.1.4 - /bin/bash

Binaries:
Node: 18.15.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.5.0 - /usr/local/bin/npm

Problem description

When installing Sharp, the installation returns an error while retrieving libvips. We're using an forward proxy. The problem is that the request generated has a wrong Host header. Instead of the actual destination (github.com), the proxy is being set as host, which is incorrect and causes problems with our forward proxy. Please see attached screenshot. The left window shows an request to registry.npmjs.org with the correct host header, the right window shows an request to Github with the wrong host header (host here is the proxy server itself, which I had to redact).
Screenshot 2023-05-02 at 16 35 58

Please change the installation script to make requests through forward proxies using the correct Host header.

@lovell
Copy link
Owner

lovell commented May 2, 2023

Do you think this might relate to request/tunnel-agent#32 ?

@lovell
Copy link
Owner

lovell commented Jun 23, 2023

Closing due to inactivity but please feel free to reopen with more details if further help is required.

@lovell lovell closed this as completed Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants