aws-sdk-java icon indicating copy to clipboard operation
aws-sdk-java copied to clipboard

Error occurred while invoking handler method: com.amazonaws.SdkClientException: Unable to execute HTTP request: Connect to ssm.us-east-1.amazonaws.com:443

Open prabhakarareddygaddam-mcd opened this issue 3 years ago • 3 comments

Describe the bug

Error occurred while invoking handler method: com.amazonaws.SdkClientException: Unable to execute HTTP request: Connect to ssm.us-east-1.amazonaws.com:443 [ssm.us-east-1.amazonaws.com/X.X.X.X] failed: connect timed out: java.lang.RuntimeException java.lang.RuntimeException: Error occurred while invoking handler method: com.amazonaws.SdkClientException: Unable to execute HTTP request: Connect to ssm.us-east-1.amazonaws.com:443 [ssm.us-east-1.amazonaws.com/X.X.X.X1] failed: connect timed out

Getting the above error during Lambda Invocation .

Expected Behavior

No timed out error

Current Behavior

Unable to execute HTTP request: Connect to ssm.us-east-1.amazonaws.com:443

Reproduction Steps

N/A

Possible Solution

No response

Additional Information/Context

No response

AWS Java SDK version used

1

JDK version used

11

Operating System and version

x86_64

I am seeing something similar, see error stack below Unable to execute HTTP request: Connect to ssm.eu-west-1.amazonaws.com:443 [ssm.eu-west-1.amazonaws.com/xxx, ssm.eu-west-1.amazonaws.com/xxx, ssm.eu-west-1.amazonaws.com/xxx] failed: connect timed out: com.amazonaws.SdkClientException com.amazonaws.SdkClientException: Unable to execute HTTP request: Connect to ssm.eu-west-1.amazonaws.com:443 [ssm.eu-west-1.amazonaws.com/xxx, ssm.eu-west-1.amazonaws.com/xxx, ssm.eu-west-1.amazonaws.com/xxx] failed: connect timed out at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleRetryableException(AmazonHttpClient.java:1114) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1064) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:743) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:717) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:699) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:667) at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649) at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513) at com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagementClient.doInvoke(AWSSimpleSystemsManagementClient.java:6894) at com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagementClient.invoke(AWSSimpleSystemsManagementClient.java:6870) at com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagementClient.executeGetParameters(AWSSimpleSystemsManagementClient.java:4269) at com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagementClient.getParameters(AWSSimpleSystemsManagementClient.java:4244)

kamdar avatar May 27 '22 20:05 kamdar

@prabhakarareddygaddam-mcd Could you please share the sample code for reproduction (including for your Lambda code) and the exact AWS SDK for Java v1 version?

ashishdhingra avatar Jun 01 '22 21:06 ashishdhingra

hi @ashishdhingra ,

Here are the dependencies I'm referring in my project 
implementation 'com.amazonaws:aws-java-sdk-s3:1.12.172'
implementation 'com.amazonaws:aws-lambda-java-core:1.2.1'
implementation 'com.amazonaws:aws-lambda-java-events:3.11.0'
implementation 'com.amazonaws:aws-java-sdk-ssm:1.12.172'
 
 below is the snipper for getting Parameter Value
 static AWSSimpleSystemsManagement ssmClientV1 = AWSSimpleSystemsManagementClientBuilder.standard()
        .withRegion(Regions.US_EAST_1).build();

private static  String getParameterValue(String paraName) {
    String paramValue = null;
    try {
        var getParameterRequest = new GetParameterRequest();
        getParameterRequest.withName(paraName)
                .withWithDecryption(true);
        var getParameterResult = ssmClientV1.getParameter(getParameterRequest);
        paramValue = getParameterResult.getParameter().getValue();
    } catch (AmazonServiceException e) {
        logger.error("Exception occurred while getting app client details:{} ", e.getMessage());
    }
    return paramValue;
}

Then making an HTTP POST(with java.net.http.HttpClient) request to generate JWT against cognitoUrl by passing Cognito app clientId, secret (which is pretty standard)

@prabhakarareddygaddam-mcd apologies this issue was left unattended for so long. Are you still experiencing the error?

"Connect timed out" indicates that the SDK tried to connect to the endpoint but the connection timed out, this is likely caused by a connectivity issue. Make sure the endpoint is reachable from the application environment, and check for any proxy settings.

debora-ito avatar Sep 08 '22 18:09 debora-ito

COMMENT VISIBILITY WARNING

Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Sep 08 '22 19:09 github-actions[bot]