if region resolves to "null" and endpoint == aws then fail fast
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 1k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 51
Description
### Describe the feature
If the SDK region resolution process ever ends up with "null.amazonaws.com" then the caller will get an unknown host exception whenever the first remote call is made. By which time it's hard to work out where that "null" string got in.
Proposed: fail fast
### Use Case
SDK-managed region resolution outside EC2 is playing up in forked processes, and I end up with stack traces
```
java.net.UnknownHostException: getFileStatus on s3a://stevel-london/test/ITestS3ACommitterMRJob-execute-magic/_SUCCESS: 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.: 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.: stevel-london.s3.null.amazonaws.com
```
this helpful message is in fact misleading; the issue is that "null.amazonaws.com" isn't *and is unlikely to ever be* an aws region. And the root cause of that is somehow from env var or ~/.aws/config lookup the region become `null`; this wasn't picked up as a resolution failure, but instead propagated to hostname construction.
No idea about how that is happening: that's my problem
### Proposed Solution
Proposed
* if the resolved region is ever `null` and the endpoint is under amazonaws.com: fail fast
* if the string value of the resolved region is null, the same.
### Other Information
_No response_
### Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### AWS Java SDK version used
2.29.52
### JDK version used
not clear. maybe java17, maybe java 8.
### Operating System and version
macos
Contributor guide
Assessment
This issue has not been assessed yet.