Skip to content

Endpoint override type is not strict enough #626

@KineticCookie

Description

@KineticCookie

Hi!
I got a strange exception trying to connect s3 client to local minio.

software.amazon.awssdk.core.exception.SdkClientException: Unable to marshall request to JSON: baseUri must not be null.
        at software.amazon.awssdk.core.exception.SdkClientException$BuilderImpl.build(SdkClientException.java:98) ~[software.amazon.awssdk.sdk-core-2.17.61.jar:?]
        at software.amazon.awssdk.services.s3.transform.HeadObjectRequestMarshaller.marshall(HeadObjectRequestMarshaller.java:53) ~[software.amazon.awssdk.s3-2.17.61.jar:?]
        ...
        at io.github.vigoo.zioaws.s3.package$S3Impl.$anonfun$headObject$1(package.scala:2392) ~[io.github.vigoo.zio-aws-s3_2.13-3.17.61.1.jar:3.17.61.1]

Caused by: java.lang.NullPointerException: baseUri must not be null.
        at software.amazon.awssdk.utils.Validate.paramNotNull(Validate.java:156) ~[software.amazon.awssdk.utils-2.17.61.jar:?]
        ...

After some experiments, I found that the type of endpointOverride defined here: https://github.com/vigoo/zio-aws/blob/master/zio-aws-core/src/main/scala/io/github/vigoo/zioaws/core/config/package.scala#L237-L239 allows for incorrect URIs to be passed to underlying aws sdk.

In my case it was minio:9000 instead of correct http://minio:9000

In my semi-educated guess, it would be better to change endpointOverride descriptor to url to enforce type safety.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions