Skip to content

Increasing timeout in LambdaAsyncClient #2287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sebarys opened this issue Feb 16, 2021 · 4 comments
Closed

Increasing timeout in LambdaAsyncClient #2287

sebarys opened this issue Feb 16, 2021 · 4 comments
Labels
documentation This is a problem with documentation. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.

Comments

@sebarys
Copy link

sebarys commented Feb 16, 2021

I was trying to increase timeout for LambdaAsyncClient unfortunately using builder I wasn't able to increase it.

Describe the issue

I've tried to increase timeout by providing custom ClientOverrideConfiguration.

Example code snippet in Scala:

    val clientOverrideConfiguration = ClientOverrideConfiguration.builder()
      .apiCallTimeout(java.time.Duration.ofSeconds(180))
      .apiCallAttemptTimeout(java.time.Duration.ofSeconds(180))
      .build()

    val lambdaAsyncClient =
      LambdaAsyncClient.builder
        .region(Region.of(awsRegion))
        .overrideConfiguration(clientOverrideConfiguration)
        .credentialsProvider(StaticCredentialsProvider.create(awsCredentials))
        .build

When I deployed above changes unfortunately it seems that timeout didn't change and I'm still receiving:

Unable to execute HTTP request: Read timed out

Could anyone point me or tell how increasing socket/connection timeout should be done properly?

@sebarys sebarys added documentation This is a problem with documentation. needs-triage This issue or PR still needs to be triaged. labels Feb 16, 2021
@debora-ito
Copy link
Member

The timeout didn't change, or the api call is taking even more than 180 seconds?
You can try to increase the socket timeout:

LambdaAsyncClient lambda = LambdaAsyncClient.builder()
    .region(Region.of(awsRegion))
    .overrideConfiguration(clientOverrideConfiguration)
    .credentialsProvider(StaticCredentialsProvider.create(awsCredentials))
    .httpClient(NettyNioAsyncHttpClient.builder()
        .readTimeout(Duration.ofSeconds(60))
        .build())
    .build();

@debora-ito debora-ito added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. and removed needs-triage This issue or PR still needs to be triaged. labels Feb 17, 2021
@sebarys
Copy link
Author

sebarys commented Feb 17, 2021

We have one lambda that is triggered very rarely but execution takes ~60seconds.

Thanks I will try this httpClient configuration!
You can consider attach snippet of code that show how override default timeouts somewhere in documentation, I saw httpClient option in builder but didn't have idea about NettyNioAsyncHttpClient.builder()

@sebarys sebarys closed this as completed Feb 17, 2021
@github-actions
Copy link

⚠️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.

@debora-ito
Copy link
Member

We have a small example in the Java SDK Dev Guide showing Netty-based HTTP Client configuration, but yes I think we can improve it.

aws-sdk-java-automation added a commit that referenced this issue Dec 13, 2022
…9631a9a95

Pull request: release <- staging/c5637b12-8d27-47c5-94d8-71d9631a9a95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation This is a problem with documentation. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.
Projects
None yet
Development

No branches or pull requests

2 participants