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

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

Open
kgabor opened this issue May 22, 2024 · 1 comment

Comments

@kgabor
Copy link

kgabor commented May 22, 2024

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

@kgabor
Copy link
Author

kgabor commented May 22, 2024

Also, we may want to add a s3UseRegion() method to obtain the region information via DefaultAwsRegionProviderChain similarly to the authentication credentials.

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

1 participant