Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET CDK ignores integration options & method responses in API Gateway methods #1904

Closed
RomainMuller opened this issue Feb 28, 2019 · 2 comments
Assignees
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. language/dotnet Related to .NET bindings p0

Comments

@RomainMuller
Copy link
Contributor

RomainMuller commented Feb 28, 2019

Regardless what is set in MethodResponses and IntegrationOptions, the cdk synth command output cloud formation wouldn't have those configuration as part of its Cloud Formation output when using cdk for .NET.

Here is the .NET C# code, you can see there are some configurations related to Status code 200

            var serviceResourceMethodResponses = new Dictionary<string, object>[] { new Dictionary<string, object>()};
            serviceResourceMethodResponses[0].Add("StatusCode", "200");
            serviceResourceMethodResponses[0].Add("ResponseModels", new Dictionary<string, string> { { "application/json", "Empty" } });
        var integrationResponseOptions = new IntegrationOptions
        {
            IntegrationResponses = new IntegrationResponse[] { new IntegrationResponse {
                        StatusCode = "200",
                        ResponseTemplates = new Dictionary<string, string> { {"application/json", "" } }
            }}
        };
            var serviceGet = new CfnMethod_(this, "serviceGetId", new CfnMethodProps
            {
                HttpMethod = "GET",
                Integration = new IntegrationProps
                {
                    Type = IntegrationType.AwsProxy,
                    Options = integrationResponseOptions,
                    IntegrationHttpMethod = "GET",
                    Uri = $"arn:aws:apigateway:{region}:lambda:path/2015-03-31/functions/{DemoAPIG.FunctionArn}/invocations"
                },
                ResourceId = serviceResource.ResourceId,
                ApiKeyRequired = false,
                AuthorizationType = "AWS_IAM",
                RestApiId = apigForWorkDocsGoService.RestApiId,
                MethodResponses = serviceResourceMethodResponses
            });
            serviceGet.AddDependsOn(serviceResource);

Here is the Cloud Formation Output from cdk synth command and no integration configuration nor the method response configuration

  serviceGetId:
    Type: AWS::ApiGateway::Method
    Properties:
      HttpMethod: GET
      ResourceId:
        Ref: serviceResourceId
      RestApiId:
        Ref: apigForDemoServiceId
      ApiKeyRequired: false
      AuthorizationType: AWS_IAM
      Integration:
        IntegrationHttpMethod: GET
        Type: AWS_PROXY
        Uri:
          Fn::Join:
            - ""
            - - arn:aws:apigateway:ap-northeast-1:lambda:path/2015-03-31/functions/
              - Fn::GetAtt:
                  - DemoAPIGId
                  - Arn
              - /invocations
    DependsOn:
      - serviceResourceId
    Metadata:
      aws:cdk:path: nrt-prod/serviceGetId
@RomainMuller RomainMuller added bug This issue is a bug. language/dotnet Related to .NET bindings @aws-cdk/aws-apigateway Related to Amazon API Gateway labels Feb 28, 2019
@eladb eladb self-assigned this Apr 2, 2019
@fulghum fulghum added the p0 label Apr 2, 2019
@fulghum
Copy link
Contributor

fulghum commented Apr 4, 2019

@eladb looks like you were poking on this one. Is this .NET specific, or are you doing something in the jsii core to address it?

@eladb
Copy link
Contributor

eladb commented Apr 4, 2019

I was thinking I'll have time this week to take a look but haven't had a chance, so this needs a bit of investigation (and also validate that it still repros, since we did make some changes that may help this).

@eladb eladb removed their assignment Apr 4, 2019
@eladb eladb self-assigned this Aug 12, 2019
@eladb eladb assigned nija-at and unassigned eladb Sep 3, 2019
@nija-at nija-at assigned RomainMuller and unassigned nija-at Nov 11, 2019
RomainMuller added a commit that referenced this issue Nov 13, 2019
RomainMuller added a commit that referenced this issue Nov 13, 2019
1. Upgrades `jsii` to `0.20.5`(fixes #4989, fixes #4966, fixes #1904, fixes #1845)
2. Fixes the `ecs-patterns` library bug #4983
3. Fixes the CLI's "legacy" mode of operation bug #4998
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. language/dotnet Related to .NET bindings p0
Projects
None yet
Development

No branches or pull requests

4 participants