Skip to content

Reusing logical ID of autogenerated HttpApi clobbers DefinitionBody #1389

@matt-tyler

Description

@matt-tyler

Description:

Howdy, I've noticed there appears to be some undefined behavior when using re-using the auto-generated ID of the 'AWS::Serverless::HttpApi' resource - specifically the logical ID 'ServerlessHttpApi'. I have not checked whether the REST API is affected as well.

Steps to reproduce the issue:

  1. Create a simple template that does not specify an 'AWS::Serverless::HttpApi', e.g. rely on auto generation by creating a serverless function type with a HttpApi event.

result: Everything works as expected

  1. Add the HTTP API resource and specify an OpenAPI document - e.g.;
  ServerlessHttpApi:
    Type: AWS::Serverless::HttpApi
    Properties:
      DefinitionBody:
        'Fn::Transform':
          Name: AWS::Include
          Parameters:
            Location: api.yaml

Observed Result: The lambda integration fields are present, but the body of the OpenAPI document has not been carried over to the Body property of 'AWS::ApiGatewayV2::Api`

expected: the transformed final template will include the OpenAPI definition in the 'AWS::ApiGatewayV2::Api' body field, with the lambda integration fields merged into the template.

If a logical ID is specified other than 'ServerlessHttpApi', everything works as expected; DefinitionBody and Integration definitions are merged as expected. This only seems to occurs when using the same logical ID that the auto-generated API would use.

Happy to dig in and contribute an appropriate fix if this an issue - whether that be documentation or a code change.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions