Defining BinaryMediaTypes globally is enabling base64 for all api end-points and overriding it from local is not reflecting possible.
#3558
-
|
Hello, I have 2 end-points, once is But at the same time, the Here is a example of my sam template file. Globals:
Api:
Cors:
AllowOrigin: "'*'"
AllowHeaders: "'*'"
AllowMethods: "'*'"
BinaryMediaTypes:
- '*/*'
Environment:
Variables:
ENDPOINT_URL: null
Resources:
savetos32:
Type: AWS::Serverless::Function
Properties:
CodeUri: ../
Description: ''
MemorySize: 128
Timeout: 3
Handler: upload-images/index.handler
Runtime: nodejs16.x
Architectures:
- x86_64
EphemeralStorage:
Size: 512
EventInvokeConfig:
MaximumEventAgeInSeconds: 21600
MaximumRetryAttempts: 2
Policies:
- Statement:
- Effect: Allow
Action:
- logs:CreateLogGroup
- logs:CreateLogStream
- logs:PutLogEvents
Resource:
- arn:aws:logs:*:*:*
SnapStart:
ApplyOn: None
Events:
Api1:
Type: Api
Properties:
Path: /upload
Method: POST
RuntimeManagementConfig:
UpdateRuntimeOn: Auto
savetodocuments:
Type: AWS::Serverless::Function
Properties:
CodeUri: ../
Description: ''
MemorySize: 128
Timeout: 3
Handler: upload-documents/index.handler
Runtime: nodejs16.x
Architectures:
- x86_64
EphemeralStorage:
Size: 512
EventInvokeConfig:
MaximumEventAgeInSeconds: 21600
MaximumRetryAttempts: 2
Policies:
- Statement:
- Effect: Allow
Action:
- logs:CreateLogGroup
- logs:CreateLogStream
- logs:PutLogEvents
Resource:
- arn:aws:logs:*:*:*
SnapStart:
ApplyOn: None
Events:
Api1:
Type: Api
Properties:
Path: /save
Method: POST
BinaryMediaTypes: []
Integration:
Type: lambda-proxy
PassthroughBehavior: WHEN_NO_MATCH
IntegrationResponses:
- StatusCode: 200
ResponseTemplates:
application/json: '{"statusCode": 200}'
Api2:
Type: Api
Properties:
Path: /save
Method: OPTIONS
RuntimeManagementConfig:
UpdateRuntimeOn: Auto
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
Reason of this is because if the property defined in globals section has type |
Beta Was this translation helpful? Give feedback.
Reason of this is because if the property defined in globals section has type
array, we actually concatenate the array defined in globals with the local property. Unfortunately there's no override on this behaviour. What you could do is not defineBinaryMediaTypesin globals.