Skip to content

N5Factory looses region information and falls back to hard-wired default with "s3://bucket/path" uri #20

Description

@kgabor

Having us-west-2 set as region in the environment variables, the following createWriter command fails:

// get us-west-2 region from AWS_REGION / AWS_DEFAULT_REGION variables
final String s3Region = new DefaultAwsRegionProviderChain().getRegion();
N5Writer w = new N5Factory().s3Region(s3Region).s3UseCredentials().createWriter( "s3://aind-scratch-data/gabor.kovacs/testcontainer.n5" );

with

com.amazonaws.services.s3.model.AmazonS3Exception: The authorization header is malformed; the region 'us-east-1' is wrong; expecting 'us-west-2' (Service: Amazon S3; Status Code: 400; Error Code: AuthorizationHeaderMalformed; Request ID: ...

I think the us-east-1 may come from here. Note that using the path-like uri that contains the region information explicitly, works:

// Works
N5Writer w = new N5Factory().createWriter( "https://s3-us-west-2.amazonaws.com/aind-scratch-data/gabor.kovacs/testcontainer.n5"

full_error.txt

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