UI Bug in HTTP (beta) Integrations

0

I'm creating a new HTTP API using CloudFormation. The template creates a test route with lambda integration. When I view the integration in the UI, it looks bugged, it's missing information and the details are empty. Is my template wrong or is this a bug in the UI?

Screenshots:

https://codifycore-public.s3-us-west-2.amazonaws.com/api-gateway-integrations-bug-01.png
https://codifycore-public.s3-us-west-2.amazonaws.com/api-gateway-edit-integration-bug.png

CloudFormation template:

{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Metadata": {
    "AWS::CloudFormation::Designer": {
      "79f7cdf8-1fde-4957-9e30-0d1064c5d99f": {
        "size": {
          "width": 60,
          "height": 60
        },
        "position": {
          "x": 260,
          "y": 70
        },
        "z": 1,
        "embeds": []
      },
      "6d19e647-11c0-42ec-bdf4-012398fe2324": {
        "size": {
          "width": 60,
          "height": 60
        },
        "position": {
          "x": 480,
          "y": 70
        },
        "z": 1,
        "embeds": []
      },
      "ef35ce79-c64f-468a-a556-27f2db988ff1": {
        "size": {
          "width": 60,
          "height": 60
        },
        "position": {
          "x": 150,
          "y": 70
        },
        "z": 1,
        "embeds": []
      },
      "7516a14e-b343-4dac-8f03-fd5e2b7dc0f7": {
        "size": {
          "width": 60,
          "height": 60
        },
        "position": {
          "x": 380,
          "y": 70
        },
        "z": 1,
        "embeds": []
      },
      "2928fc4a-d018-4b97-b9bf-945e935370a0": {
        "size": {
          "width": 60,
          "height": 60
        },
        "position": {
          "x": 260,
          "y": 180
        },
        "z": 1,
        "embeds": []
      },
      "2ef49365-4aa4-43db-a233-3e590eb62520": {
        "size": {
          "width": 60,
          "height": 60
        },
        "position": {
          "x": 580,
          "y": 70
        },
        "z": 0,
        "embeds": []
      },
      "3d44bc9d-733c-4b7f-9bb8-592454c8b016": {
        "size": {
          "width": 60,
          "height": 60
        },
        "position": {
          "x": 380,
          "y": 180
        },
        "z": 0,
        "embeds": []
      }
    }
  },
  "Parameters": {},
  "Resources": {
    "MyTestApi": {
      "Type": "AWS::ApiGatewayV2::Api",
      "Properties": {
        "Name": "MyTestApi",
        "ProtocolType": "HTTP"
      },
      "Metadata": {
        "AWS::CloudFormation::Designer": {
          "id": "79f7cdf8-1fde-4957-9e30-0d1064c5d99f"
        }
      }
    },
    "TestFunction": {
      "Type": "AWS::Lambda::Function",
      "Properties": {
        "Handler": "index.handler",
        "FunctionName": "MyApiTestFunction",
        "Role": {
          "Fn::GetAtt": [
            "TestFunctionRole",
            "Arn"
          ]
        },
        "Runtime": "nodejs12.x",
        "Code": {
          "ZipFile": "exports.handler = async function(event, context) { return {statusCode: 200, body: JSON.stringify({message: 'Success'})}; }"
        }
      },
      "Metadata": {
        "AWS::CloudFormation::Designer": {
          "id": "6d19e647-11c0-42ec-bdf4-012398fe2324"
        }
      }
    },
    "ProdStage": {
      "Type": "AWS::ApiGatewayV2::Stage",
      "Properties": {
        "AutoDeploy": true,
        "StageName": "$default",
        "ApiId": {
          "Ref": "MyTestApi"
        }
      },
      "Metadata": {
        "AWS::CloudFormation::Designer": {
          "id": "ef35ce79-c64f-468a-a556-27f2db988ff1"
        }
      }
    },
    "TestRoute": {
      "Type": "AWS::ApiGatewayV2::Route",
      "Properties": {
        "ApiId": {
          "Ref": "MyTestApi"
        },
        "RouteKey": "GET /test",
        "Target": {
          "Fn::Join": [
            "/",
            [
              "integrations",
              {
                "Ref": "TestIntegration"
              }
            ]
          ]
        }
      },
      "Metadata": {
        "AWS::CloudFormation::Designer": {
          "id": "2928fc4a-d018-4b97-b9bf-945e935370a0"
        }
      }
    },
    "TestIntegration": {
      "Type": "AWS::ApiGatewayV2::Integration",
      "Properties": {
        "ApiId": {
          "Ref": "MyTestApi"
        },
        "CredentialsArn": {
          "Fn::GetAtt": [
            "ApiGatewayInvokationRole",
            "Arn"
          ]
        },
        "IntegrationType": "AWS_PROXY",
        "IntegrationMethod": "POST",
        "PayloadFormatVersion": "1.0",
        "IntegrationUri": {
          "Fn::GetAtt": [
            "TestFunction",
            "Arn"
          ]
        }
      },
      "Metadata": {
        "AWS::CloudFormation::Designer": {
          "id": "7516a14e-b343-4dac-8f03-fd5e2b7dc0f7"
        }
      }
    },
    "TestFunctionRole": {
      "Type": "AWS::IAM::Role",
      "Properties": {
        "AssumeRolePolicyDocument": {
          "Version": "2012-10-17",
          "Statement": [
            {
              "Effect": "Allow",
              "Principal": {
                "Service": "lambda.amazonaws.com"
              },
              "Action": "sts:AssumeRole"
            }
          ]
        },
        "Policies": [
          {
            "PolicyName": "TestFunctionPolicy",
            "PolicyDocument": {
              "Version": "2012-10-17",
              "Statement": [
                {
                  "Effect": "Allow",
                  "Action": "logs:CreateLogGroup",
                  "Resource": {
                    "Fn::Sub": "arn:aws:logs:${AWS::Region}:${AWS::AccountId}:*"
                  }
                },
                {
                  "Effect": "Allow",
                  "Action": [
                    "logs:CreateLogStream",
                    "logs:PutLogEvents"
                  ],
                  "Resource": [
                    {
                      "Fn::Sub": "arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/testfunction:*"
                    }
                  ]
                }
              ]
            }
          }
        ]
      },
      "Metadata": {
        "AWS::CloudFormation::Designer": {
          "id": "2ef49365-4aa4-43db-a233-3e590eb62520"
        }
      }
    },
    "ApiGatewayInvokationRole": {
      "Type": "AWS::IAM::Role",
      "Properties": {
        "AssumeRolePolicyDocument": {
          "Version": "2012-10-17",
          "Statement": [
            {
              "Effect": "Allow",
              "Principal": {
                "Service": "apigateway.amazonaws.com"
              },
              "Action": "sts:AssumeRole"
            }
          ]
        },
        "Policies": [
          {
            "PolicyName": "ApiGatewayInvokationRole",
            "PolicyDocument": {
              "Version": "2012-10-17",
              "Statement": [
                {
                  "Effect": "Allow",
                  "Action": "lambda:InvokeFunction",
                  "Resource": {
                    "Fn::Sub": "arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:*"
                  }
                }
              ]
            }
          }
        ]
      },
      "Metadata": {
        "AWS::CloudFormation::Designer": {
          "id": "3d44bc9d-733c-4b7f-9bb8-592454c8b016"
        }
      }
    }
  }
}

Edited by: khatiba on Jan 28, 2020 5:31 PM

khatiba
gefragt vor 4 Jahren203 Aufrufe
2 Antworten
0
Akzeptierte Antwort

Hi khatiba,

Thanks for bringing this to our attention. HTTP APIs support 2 ARN formats in the IntegrationUri which I will refer to as "Short Format" and "Long Format". In your template, you're using the Short Format which is just the Lambda ARN. This should work but we have a bug with how we render this on the Console. We'll get this fixed.

In the meantime, you can use the Long Format which will render properly. The long format looks like this:
arn:aws:apigateway:{api-region}:lambda:path/2015-03-31/functions/arn:aws:lambda:{lambda-region:account-id}:function:{lambda-function-name}/invocations

Let me know if this works.

Thanks,
Alan

AWS
beantwortet vor 4 Jahren
0

Hi Alan,
Thanks for the quick reply. I had run across the "long format" you noted, but wasn't sure which to use. I tried it out and the issue is fixed.

Thanks,
Ahmad

Edited by: khatiba on Jan 28, 2020 8:23 PM

khatiba
beantwortet vor 4 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen