Skip to content

s3ForcePathStyle works for publishing but not installation #607

@jared-duo

Description

@jared-duo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions