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

Is mirroring broken? #250

Closed
mstade opened this issue Nov 7, 2016 · 5 comments
Closed

Is mirroring broken? #250

mstade opened this issue Nov 7, 2016 · 5 comments

Comments

@mstade
Copy link

mstade commented Nov 7, 2016

Hi!

I'm trying to figure out how to install sqlite3 via a download mirror (see TryGhost/node-sqlite3#734 for further details) since we're firewalled and need to host a mirror of prebuilt binaries. However, when I try the following (on a non-firewalled box) it doesn't seem to actually override the host:

npm install sqlite3 --sqlite3_binary_host_mirror=http://obviouslynonexistant/

I would expect this to fail, but it merrily goes out to the S3 bucket described in sqlite3's package.json and downloads the correct binary. Does it fall back some how? I've locked through the code and see no such fallback, nor does --verbose logging yield any more detail. Am I not using the mirror option correctly?

Also related to this, we won't be able to set this flag directly, since we'll be installing a dependency that itself depends on sqlite3 – will the config variable be correctly used no matter how deep the dependency that uses node-pre-gyp is?

@springmeyer
Copy link
Contributor

It looks like the option will be --node_sqlite3_binary_host_mirror=http://obviouslynonexistant/ because the support for mirrors added in #170 uses module_name at

var host = process.env['npm_config_' + opts.module_name + '_binary_host_mirror'] || package_json.binary.host;
and module_name os node_sqlite3 at https://github.com/mapbox/node-sqlite3/blob/4800c6377ef15f467290d77776302b486e71ada3/package.json#L11. The idea behind having both module_name and name is that sometimes the package name has a dash or some other character that is invalid to be used for the C++ module name. However, in the node-sqlite3 case I think module_name could be == to name. It ended up as module_name since it was that since well before the project was ported to used node-pre-gyp.

@mstade
Copy link
Author

mstade commented Nov 7, 2016

Thanks for that @springmeyer! Super insightful – I didn't know the difference, thanks for teaching me! So I tried your suggestion, but --node_sqlite3_binary_host_mirror=http://obviouslynonexistant/ still works. I'll see if I can print the value of module_name somehow...

@springmeyer
Copy link
Contributor

@mstade Locally I put a print statement at

var host = process.env['npm_config_' + opts.module_name + '_binary_host_mirror'] || package_json.binary.host;
and host is == to http://obviouslynonexistant/ when I do:

cd node-sqlite3/
npm install --node_sqlite3_binary_host_mirror=http://obviouslynonexistant/

Is that not what you are seeing?

@mstade
Copy link
Author

mstade commented Nov 7, 2016

My apologies! I just realized that I tried installing jsbin with the mirror option, and jsbin depends on a very old version of sqlite3 which in turn depends on a version of node-pre-gyp that doesn't have the mirroring feature. I tried it again with a current version of sqlite3 and it does work.

I've opened jsbin/jsbin#2927 to fix this where it needs fixing. Your project does exactly what it says on the tin with regards to this feature, so this is entirely my bad. Many apologies for wasting your time, and thank you very much for your support! :o)

@mstade mstade closed this as completed Nov 7, 2016
@Mazza-Chen
Copy link

SSL-intercepting proxy

thanks for @mstade and @springmeyer
My problem is that my org's internal network has a WAF appliance, it intercept SSL/TLS traffic and replace site's certificate with our self-signed-cert
this SSL-intercepting proxy hinder node-pre-gyp from downloading node-v48-win32-ia32.tar.gz on amazon s3
So I use your advise that putting the binary file on my express-enabled machine, using the command:

npm install -g sqlite3 --node_sqlite3_binary_host_mirror=http://192.168.157.33:3000

it successfully install [email protected] without the error "node-pre-gyp ERR! Tried to download(undefined) ......"

BTW , now [email protected] can use npm's cafile option for dealing self-signed-cert #243

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

No branches or pull requests

3 participants