question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Document use of disableHostPrefixInjection for 2.18.x

See original GitHub issue

2.18.x introduced virtual bucket addressing as standard

i.e. Before 2.18.x: I connected to bucket foo on mys3stub.mynetwork.local But now: the SDK changes my configured hostname on the fly and tries to connect to foo.mys3stub.mynetwork.local.

I don’t want to to have to setup DNS for every bucket name, I’d rather have the SDK connect the old way, without it modifying the hostname I configured. It’s unclear how to achieve this.

I can’t find any documentation on how to use disableHostPrefixInjection which I think from reading the code will stop this behaviour happening. Can it be documented? (and can anyone tell me the recommended way to use it?)

UPDATE: On further testing this doesn’t seem to be the right option - any documentation you can provide on how to go back to having the bucket name in the path would be great

UPDATE 2: I’ve found something that works - is it right?

.forcePathStyle(true) - code example is Scala

  implicit val clientAsync: S3AsyncClient =
    S3AsyncClient
      .builder()
      .credentialsProvider(credentialsProvider)
      .region(region)
      .forcePathStyle(true)
      .endpointOverride(s3Uri)
      .build()

Links

NA (not sure where it’s best to put it)

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
LuckySpbcommented, Nov 3, 2022

I suggest that SDK error message would give a hint on what is incorrect. Current error message diverts from root cause. software.amazon.awssdk.core.exception.SdkClientException: Received an UnknownHostException when attempting to interact with a service. See cause for the exact endpoint that is failing to resolve. If this is happening on an endpoint that previously worked, there may be a network connectivity issue or your DNS cache could be storing endpoints for too long.

In my usecase I had S3 on localstack for testing.

0reactions
yasminetalbycommented, Nov 3, 2022

Hello @LuckySpb ,

Thank you very much for your feedback and for providing your use case. I have added a backlog item to provide better documentation support for the new SDK behavior. Your comment is very helpful to us!

I will update this ticket with all changes made.

Sincerely,

Yasmine

Read more comments on GitHub >

github_iconTop Results From Across the Web

ClientConfiguration (AWS SDK for Java - 1.12.362)
Sets the expiration time (in milliseconds) for a connection in the connection pool. void, setDisableHostPrefixInjection(boolean disableHostPrefixInjection).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found