awslabs / aws-solutions-constructs

The AWS Solutions Constructs Library is an open-source extension of the AWS Cloud Development Kit (AWS CDK) that provides multi-service, well-architected patterns for quickly defining solutions
https://docs.aws.amazon.com/solutions/latest/constructs/
Apache License 2.0
1.19k stars 240 forks source link

API Gateway To Lambda: timeout cannot be over 29 seconds #1137

Closed kraashen closed 1 week ago

kraashen commented 3 weeks ago

AWS API Gateway timeout limit for integrations was previously 29 seconds. There has been an update to allow increasing the Gateway integration timeouts past the previous limit. https://aws.amazon.com/about-aws/whats-new/2024/06/amazon-api-gateway-integration-timeout-limit-29-seconds/

However, when implementing a Gateway API to Lambda, it seems that when synth'ing the stack, this seems to hit a validation error.

Reproduction Steps

const ApiGateway = new ApiGatewayToLambda(
      this,
      'MyAPIGW',
      {
        lambdaFunctionProps: {
          runtime: Runtime.PROVIDED_AL2,
          handler: 'bootstrap',
          code: Code.fromAsset(join(__dirname, '..', '..', 'target', 'bin', 'linux', 'amd64', 'lambda', 'runtime')),
          timeout: Duration.minutes(5),
          environment: {
            ...
          },
        },
        apiGatewayProps: {
          defaultCorsPreflightOptions: {
            allowOrigins: ['*'],
            allowMethods: [HttpMethod.POST],
          },
          integrationOptions: {
            timeout: Duration.seconds(60),
          },
        },
      },
    );

Error Log

WARN AWS_SOLUTIONS_CONSTRUCTS_WARNING:  Possible override of timeout value.
Failed to synthesize: Error: Integration timeout must be between 50 milliseconds and 29 seconds.

Environment


This is :bug: Bug Report

kraashen commented 3 weeks ago

Based on quick triage, this error seems to propagate from the aws-cdk core library: https://github.com/aws/aws-cdk/blob/db3e77d4b32a7464b38f8502d7c113ac163e17dc/packages/aws-cdk-lib/aws-apigateway/lib/integration.ts#L207-L209

kraashen commented 2 weeks ago

Fixed in aws-cdk release https://github.com/aws/aws-cdk/releases/tag/v2.147.0

biffgaut commented 1 week ago

Sorry for the slow response, thanks for following up.