Skip to content

Can't poll from S3 with a custom endpoint configuration #160

@xfrancois

Description

@xfrancois

Hello,

Here is the related and more detailled issue on stackoverflow

I think there is an issue in the getHostPort() method of S3Session.java. This method doesn't look for the signing region field that an user may have filled. It only looks for amazonaws.com region, and then throws an IllegalArgumentException : S3 client with invalid S3 endpoint configured if there is no match between the user provided url and the regional pattern s3[-.]([^.]+)\.amazonaws\.com(\.[^.]*)?

spring-integration-aws - S3Session.java

@Override
	public String getHostPort() {
		Region region = this.amazonS3.getRegion().toAWSRegion();
		return String.format("%s.%s.%s:%d", AmazonS3.ENDPOINT_PREFIX, region.getName(), region.getDomain(), 443);
	}

aws-java-sdk-s3 - AmazonS3Client.java

 @Override
    public synchronized Region getRegion() {
        String authority = super.endpoint.getAuthority();
        if (Constants.S3_HOSTNAME.equals(authority)) {
            return Region.US_Standard;
        } else {
            Matcher m = Region.S3_REGIONAL_ENDPOINT_PATTERN.matcher(authority);
            if (m.matches()) {
                return Region.fromValue(m.group(1));
            } else {
                throw new IllegalStateException(
                    "S3 client with invalid S3 endpoint configured: " + authority);
            }
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions