title: How to fix aws lambda timeouts on synchronous invokes with C++ SDK?
body: <p>When I invoke my lambda function it takes between 1 and 15 seconds to execute. If I invoke the function via the C++ SKD, I get timeouts. These timeouts seem to occur after a few seconds (this is human-judgment only, I did not actually time it).</p>
  <p><strong>Question:</strong> How do I tell the SDK to wait for slow lambdas to return and not to timeout?</p>
  <p><strong>Things that did not work:</strong></p>
  <p>In the <a href="https://stackoverflow.com/questions/38914954/aws-lambda-invoke-function-js-sdk-timeout-resets-to-default">JS SDK you can change this in the HTTP settings</a>. This is is no such option in the C++ SDK <a href="https://sdk.amazonaws.com/cpp/api/LATEST/struct_aws_1_1_http_options.html" rel="nofollow noreferrer">HTTPOptions</a>.</p>
  <p>It does not help to give the lambda client a <a href="https://sdk.amazonaws.com/cpp/api/LATEST/struct_aws_1_1_client_1_1_client_configuration.html" rel="nofollow noreferrer">config</a> with a larger connectionTimeoutMS (socket timeout). Also, the httpRequestTimeoutMs of the client is set to 0 by default, meaning it will wait forever.</p>
  <p>I am using <a href="https://sdk.amazonaws.com/cpp/api/LATEST/class_aws_1_1_lambda_1_1_model_1_1_invoke_request.html" rel="nofollow noreferrer">synchronous requests</a>, which do not seem to have an extra option for timeouts.</p>
  <p><strong>Additional information:</strong></p>
  <p>I am using a single client to run multiple requests in parallel.</p>
  <p>Error also happens if I am using async requests.</p>
  <p><strong>Related:</strong></p>
  <p><a href="https://aws.amazon.com/premiumsupport/knowledge-center/lambda-function-retry-timeout-sdk/" rel="nofollow noreferrer">How do I troubleshoot retry and timeout issues when invoking a Lambda function using an AWS SDK?</a></p>