Open takeshixx opened 5 days ago
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
@takeshixx can you take a look at the build logs to see why it's failing?
I talked to @paulhcsun, it seems to be the breaking changes to API Gateway. I mentioned it in #18297 as well. The reason is that it affects every call to addCorsPreflight()
.
Set
passthroughBehavior
behavior toNEVER
to prevent errors for CORS preflight requests with content-types other thanapplication/json
.Issue # (if applicable)
This was reported as #18297, but it was closed without a fix.
Reason for this change
Using
addCorsPreflight()
will add a mock integration forOPTIONS
requests and maps them to content-typeapplication/json
.OPTIONS
requests with a content-type header other thanapplication/json
lead to HTTP 500 Internal Server Errors.Description of changes
Setting the
passthroughBehavior
toNEVER
returns a mime type error instead of a internal server error, which is the appropriate response.It should be noted that this setting was proposed in the initial implementation of
addCorsPreflight()
in #906 already. However, it looks like it didn't make it into the CDK. Instead the default configuration is use, which sets it toWHEN_NO_MATCH
.Description of how you validated changes
I tested the change by manually overriding the
passthroughBehavior
on theLambdaRestApi
resource:Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license