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

Unable to define minimumCompressionSize and a few other API Gateway settings in template #519

Closed
zfoster opened this issue Jul 23, 2018 · 6 comments
Labels
contributors/good-first-issue Good first issue for a contributor

Comments

@zfoster
Copy link

zfoster commented Jul 23, 2018

I searched the issues and don't see a duplicate for any of the following keys that seem to be unsupported by AWS::Serverless::Api

Failing body is below with explanations. The seemingly unsupported keys are:

MinimumCompressionSize

and

MethodSettings:

  • RequireAuthorizationForCacheControl
  • UnauthorizedCacheControlHeaderStrategy

As the CLI can create an API with these, I'd expect them to work with the serverless transform. I see the issue #248 has a lot of work for additional fields (some of which I'm even using 😄) but enabling these manually would essentially be a blocker for us at bustle trying to use SAM. Are there any workarounds or do these belong somewhere other than Properties, etc?

Note: the following will deploy with the comments removed, and will fail if any of these fields are added one off.

"MyAPI": {
      "Type": "AWS::Serverless::Api",
      "Properties": {
        "StageName": { "Ref": "environment" },
        "CacheClusterEnabled": true,
        // "MinimumCompressionSize": 1024,
        "CacheClusterSize": "6.1",
        "MethodSettings": [
          {
            "LoggingLevel": "ERROR",
            "ResourcePath": "/*",
            "HttpMethod": "POST, OPTIONS",
            "ThrottlingBurstLimit": 5000,
            "ThrottlingRateLimit": 10000
            // "RequireAuthorizationForCacheControl": true
            // "UnauthorizedCacheControlHeaderStrategy": "SUCCEED_WITH_RESPONSE_HEADER"
          },
          {
          "LoggingLevel": "ERROR",
          "CacheTtlInSeconds": 60,
          "ResourcePath": "/*",
          "HttpMethod": "GET",
          "ThrottlingBurstLimit": 5000,
          "ThrottlingRateLimit": 10000
          // "RequireAuthorizationForCacheControl": true
          // "UnauthorizedCacheControlHeaderStrategy": "SUCCEED_WITH_RESPONSE_HEADER"
        }],

Thanks in advance for any insight!

@zfoster
Copy link
Author

zfoster commented Jul 24, 2018

Some follow up notes:

I was able to add minimumCompressionSize by including it as such in my swagger DefinitionBody:

"DefinitionBody": {
          "swagger": "2.0",
          "info": { "title": { "Ref": "AWS::StackName" } },
          "x-amazon-apigateway-minimum-compression-size": 1024
...
}

The other two fields,

requireAuthorizationForCacheControl

and

UnauthorizedCacheControlHeaderStrategy

seem to default to the values I have listed, however I would still prefer if all of these things were configurable without a custom resource.

@rm-hull
Copy link
Contributor

rm-hull commented Jan 26, 2019

Add minimum compression size is logged in issue #419

@brettstack brettstack added the contributors/good-first-issue Good first issue for a contributor label Feb 1, 2019
@brettstack
Copy link
Contributor

RequireAuthorizationForCacheControl and UnauthorizedCacheControlHeaderStrategy are Stage level settings, and don't belong in MethodSettings. Unfortunately we haven't configured AWS::Serverless::Api to accept these two properties, but it should be a simple PR for anyone interested in adding them.

Main areas to modify are:

https://github.com/awslabs/serverless-application-model/blob/master/samtranslator/model/apigateway.py#L28

https://github.com/awslabs/serverless-application-model/blob/master/samtranslator/model/api/api_generator.py#L150

https://github.com/awslabs/serverless-application-model/blob/master/samtranslator/model/sam_resources.py#L459

Then add tests and docs 👍

@eduardovra
Copy link
Contributor

I would like to contribute on this issue, but couldn't find these parameters on the cloudformation docs. Can you confirm this is already supported ?

https://docs.aws.amazon.com/apigateway/api-reference/resource/stage/
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-stage-methodsetting.html

Thanks

@praneetap
Copy link
Contributor

I see that MinimumCompressionSize support was released with this PR #786

I don't see the other two supported in CFN, you are right @eduardovra. We will reach out to the right teams with this information, thank you.

@jfuss
Copy link
Contributor

jfuss commented Aug 9, 2021

Still looks like RequireAuthorizationForCacheControl and UnauthorizedCacheControlHeaderStrategy are still not in CloudFormation.

MinimumCompressionSize is already supporting.

Closing. Given we don't have a current path on the outstanding ones, I am going to close this. Feel free to re-open once there is a path for support.

@jfuss jfuss closed this as completed Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributors/good-first-issue Good first issue for a contributor
Projects
None yet
Development

No branches or pull requests

7 participants