I am using LocalStack for a local S3 for verification, integration tests etc., so I am using localhost and other domains not part of the normal production AWS forms.
I have followed the configuration instructions here and publishing works perfectly, but the hosted_path property in the lib/utils/versioning.js doesn't take this parameter into account (we can see in the PR that introduces the s3ForcePathStyle parameter that the evaluate method in versioning.js accepts the parameter, but never uses it.)
I believe the opts.hosted_path needs to be altered to account for the bucket name being part of the path so that installation may also occur from a non-standard AWS path.
Example:
Given a
package.json
{
...
"binary": {
"module_name": "my-module",
"module_path": "<some_path>",
"remote_path": "/npm/{module_name}/addon/",
"package_name": "{module_name}.tar.gz",
"host": "https://localhost.localstack.cloud:4566",
"region": "us-east-1",
"bucket": "my-packages",
"s3ForcePathStyle": true
}
...
}
and an S3 bucket available at https://localhost.localstack.cloud:4566/my-packages an invocation of node-pre-gyp publish will place the tarball correctly in https://localhost.localstack.cloud:4566/my-packages/npm/my-module/addon/my-module.tar.gz, but an invocation of node-pre-gyp install will try to download the tarball from https://localhost.localstack.cloud:4566/npm/my-module/addon/my-module.tar.gz - notably without the bucket in the path.
I am using LocalStack for a local S3 for verification, integration tests etc., so I am using
localhostand other domains not part of the normal production AWS forms.I have followed the configuration instructions here and publishing works perfectly, but the
hosted_pathproperty in thelib/utils/versioning.jsdoesn't take this parameter into account (we can see in the PR that introduces thes3ForcePathStyleparameter that theevaluatemethod inversioning.jsaccepts the parameter, but never uses it.)I believe the
opts.hosted_pathneeds to be altered to account for the bucket name being part of the path so that installation may also occur from a non-standard AWS path.Example:
Given a
package.json{ ... "binary": { "module_name": "my-module", "module_path": "<some_path>", "remote_path": "/npm/{module_name}/addon/", "package_name": "{module_name}.tar.gz", "host": "https://localhost.localstack.cloud:4566", "region": "us-east-1", "bucket": "my-packages", "s3ForcePathStyle": true } ... }and an S3 bucket available at
https://localhost.localstack.cloud:4566/my-packagesan invocation ofnode-pre-gyp publishwill place the tarball correctly inhttps://localhost.localstack.cloud:4566/my-packages/npm/my-module/addon/my-module.tar.gz, but an invocation ofnode-pre-gyp installwill try to download the tarball fromhttps://localhost.localstack.cloud:4566/npm/my-module/addon/my-module.tar.gz- notably without the bucket in the path.