aws / aws/serverless-application-model

Unable to set "contentHandling"

Open
#553 13 comments 3 reactions 0 assignees View on GitHub
area/resource/api contributors/good-first-issue maintainer/need-followup type/feature
Dominant language
Python
Stars
9.6k
Forks
2.5k
Avg merge
1d 11h
Merged PRs (30d)
7

Description

I've found that setting the 'x-amazon-apigateway-binary-media-types' to `*/*` causes 500 errors.

Using the API to set the content handling to "CONVERT_TO_TEXT" resolves the issue, but there doesn't seem to be a way to define that in the SAM CORS configuration, so the requests will always fail. (See below for error)

The error from API gateway is as follows:

```
14:52:31 Method request body before transformations: [Binary Data]
14:52:31 Execution failed due to configuration error: Unable to transform request
14:52:31 Gateway response type: API_CONFIGURATION_ERROR with status code: 500
14:52:31 Gateway response body:
{
"detail": "Internal server error",
"title": "API_CONFIGURATION_ERROR",
"status": 500
}
```

This is the output of the API integration in a _working_ case:

```
{
"integrationResponses": {
"200": {
"responseTemplates": {
"application/json": null
},
"selectionPattern": "",
"statusCode": "200"
}
},
"contentHandling": "CONVERT_TO_TEXT",
"timeoutInMillis": 29000,
"passthroughBehavior": "NEVER",
"requestTemplates": {
"application/json": "{\"statusCode\": 200}"
},
"cacheNamespace": "******",
"type": "MOCK",
"cacheKeyParameters": []
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.