serverless-application-model: Globals/Api/BinaryMediaTypes is not honored when SAM template is updated and re-deployed

Description: BinaryMediaTypes is removed from APIGW settings when SAM template is updated and re-deployed

Steps to reproduce the issue:

  1. Create a simple SAM application with Globals as follows:
Globals:
    Api:
        BinaryMediaTypes:
            - "*~1*"
  1. Package and deploy. Observe Settings section of the new APIGW API. Binary Media Types will have */*

  2. Make some changes to the SAM template. Re-package and re-deploy. Observe Settings section of the APIGW API. Binary Media Types config is empty/missing

Observed result: Binary Media Types config is empty/missing after SAM template is updated and redeployed

Expected result: Binary Media Types does not change after stack update.

Output of sam --version: SAM CLI, version 0.6.0

Optional Debug logs:

Add --debug flag to command you are running

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 16 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Also encountering this error. We are currently working around it by manually updating in the console and deploying the api manually. Not ideal!

In our case we want BinaryMediaTypes: ['*/*'] but that fails. Changing the value to *~1* also does not persist.

Further clarification: creating a fresh stack will work with *~1* (but it appears updates it does not). I’ll cobble a reduced case 🔜 .

I have created an example with steps to reliably reproduce the behavior. It looks like anything that results in updating the deployment of apigateway will remove the binary media types.

https://github.com/brianleroux/cloudformation-update-stack-removes-binary-media-types