-
Notifications
You must be signed in to change notification settings - Fork 403
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
Docs: In the SAM template, BinaryMediaTypes and CORS do not work together #3373
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
hey @martinber sad to hear you bumped into a known issue in SAM exacerbated by our incorrect docs. We'll add a note and push a doc rebuild by EOD, and give the SAM team a heads up about it. Thank you @martinber for flagging this to us, truly. NOTE: I'll read the entire thread to make sure I fully understand whether this is an API Gateway, SAM or SAM CLI limitation, and document accordingly. If there's a known workaround, we'll update the template too. |
Tested and here's a summary for anyone coming in later on the issue:
Action. Adding a comment in the template and in the Binary section to highlight this limitation in API Gateway. workaround You could use API Gateway as a passthrough for pre-flight requests by configuring it to send We don't document it yet because by default as ~90% of the time API Gateway handles just fine, and this can create confusion. This is typically used as a workaround for another issue - e.g., multi-origin. |
Thank you! This is more than enough for me |
Merged, gonna prep a release now so nobody else bumps into this (hopefully). If we get yet another customer, I'll personally create a complete workaround example to handle CORS along with caveats. Thank you one more time @martinber for taking the time to report this. We appreciate your care on making everyone's experience better! |
|
This is now released under 2.27.1 version! |
What were you searching in the docs?
How to configure CORS
Is this related to an existing documentation section?
https://docs.powertools.aws.dev/lambda/python/latest/core/event_handler/api_gateway/#required-resources
How can we improve?
If I'm not wrong, when configuring CORS in the
template.yml
of AWS SAM, CORS doesn't work ifBinaryMediaTypes
is set. See this issue.The example in the documentation has both CORS and
BinaryMediaTypes
configured. I just copied this example without thinking much and I was surprised to see that it doesn't work. I think that at least a note should be added somewhere to indicate that these two are incompatible.Got a suggestion in mind?
No response
Acknowledgment
The text was updated successfully, but these errors were encountered: