Skip to content

AWS APIgateway: fromRestApiAttributes does not bring all the RestAPI configuration #29079

@wascou

Description

@wascou

Describe the bug

I was following this documentation section, where there's a workaround for multiple stack describing api gateway resources:

Breaking up Methods and Resources across Stacks
It is fairly common for REST APIs with a large number of Resources and Methods to hit the CloudFormation limit of 500 resources per stack.

So I broke my stack in several nested stacks and imported back my api in each nested stack using the ``fromRestApiAttributes``` method. The correct object was found but not all the configuration appeared.

Expected Behavior

I was expecting the full object as set during the API creation in the main stack.

Current Behavior

Dumping the object, I had the following:

{
...
    defaultIntegration: undefined,
    defaultMethodOptions: undefined,
    defaultCorsPreflightOptions: undefined
...
}

instead of:

{
...
    defaultIntegration: undefined,
    defaultMethodOptions: undefined,
    defaultCorsPreflightOptions: { allowOrigins: [Array], allowMethods: [Array] },
...
}

Reproduction Steps

The following piece of code as mentionned in the documentation:
https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway-readme.html#breaking-up-methods-and-resources-across-stacks

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.127.0 (build 6c90efc)

Framework Version

No response

Node.js Version

v21.1.0

OS

Mac

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-apigatewayRelated to Amazon API GatewaybugThis issue is a bug.effort/mediumMedium work item – several days of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions