-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Support New AWS APIGW Binary Responses #2797
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
Comments
Does it mean we will be able to gzip response? |
My team is eagerly anticipating this feature in Serverless. We have an image resizing service that currently needs to proxy responses through a traditional server to return images... 😫 Does anybody know of a workaround we could use until this is added to Serverless? |
The most traditional approach is to upload image to S3 and return a direct
link.
…On Sat, 17 Dec 2016, 02:39 Adam Biggs, ***@***.***> wrote:
My team is eagerly anticipating this feature in Serverless. We have an
image resizing service that currently needs to proxy responses through a
traditional server to return images... 😫
Does anybody know of a workaround we could use until this is added to
Serverless?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2797 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADo_pHi23FjxxbwEfnIlr5ufVpylQVQIks5rIy9SgaJpZM4K8svv>
.
|
@vladgolubev our image resizing service resizes the images on-demand based on query string params. The lambda first checks if the requested image size already exists on S3. If it does, it returns the existing image, and if not it generates it, stores it on S3 and then returns it. So direct S3 links won't work for us. Our current workaround is to run a simple Node.js reverse proxy that calls the Lambda image resize service, gets the direct S3 link, and then returns the binary response to the client... But this is a temporary solution. When Serverless adds binary response support (or if we can find a workaround, like making changes directly in AWS after deploying with Serverless) we can get rid of the reverse proxy without changing any previously generated image URLs. |
Note: there's some thread in the forum about this: http://forum.serverless.com/t/returning-binary-data-jpg-from-lambda-via-api-gateway/796 and sure you can also gzip: https://github.com/bustlelabs/gziptest/ (not using serverless) I would, however, not expect too much from it since |
@pmuens seems like somebody got it to work: http://forum.serverless.com/t/returning-binary-data-jpg-from-lambda-via-api-gateway/796 |
Wow that's pretty cool! Thanks for sharing! 👍 |
Removed from the 1.14 milestone since we're still waiting on CloudFormation support. |
Is there a timeline from AWS for CF support? |
We ended up defining our function through serverless but defined the API gateway in the resources section with swagger yml. Works great. |
@schickling unfortunately not yet.
That sounds like a good workaround. Thanks for sharing @vangorra 👍 For everyone else who wants to use this now. A new Serverless plugin for this was published recently: https://github.com/ryanmurakami/serverless-apigwy-binary |
Any word on the CF support? I am having some troubles with the mentioned plugin, mainly because it forces me to change the integration from I was however able to make my binary endpoint work by using the
Does anyone know if this be the approach for the official serverless support, or will we have to work with |
Good news, it appears that CloudFormation now supports binary media types! https://aws.amazon.com/about-aws/whats-new/2017/07/aws-cloudformation-coverage-updates-for-amazon-api-gateway--amazon-ec2--amazon-emr--amazon-dynamodb-and-more/ |
This is great news! I have been using manual instructions on how to set the api binary types on my serverless phantomJS screenshot project README file, but I would be more than happy to remove the guides once we get a version of serverless out which properly supports this :) Ping @brianneisler for the good news and expedited future roadmap inclusion 👍 |
Nice! Thanks for posting the update @ajkerr 👍 @amv thanks for your comment! This has been on the roadmap for a long time and has a pretty high priority. Unfortunately it was blocked by the lack of CloudFormation support (until now 🙏). Anyone here who would like to jump into an implementation / WIP PR? We're more than happy to help out when problems come up! This way we can get it ready for v1.18 or v1.19. |
@pmuens I'd like to give this a go tomorrow! First contribution to severless so I'd appreciate being pointed in the right direction. |
Awesome @rcoh! That's super nice 🎉 🙌 👍 Let me see... So it looks like support for the You can find the code for the compilation of the Other than that it looks like this documentation describes how everything should work together. The only thing I haven't found yet is the config for 🤔 not sure if it's not added yet or if it's undocumented. Other than that there's also this forum link which might shed some lights into the way this works in general. Thanks again for looking into this @rcoh 👍 Let us know if you need anything else! Happy to help you get this into |
Started to work on this. Was hoping to be able to test my changes to serverless by using
Unrelated to that, what were you think of for the API from the serverless/end user side of things @pmuens ? |
Great @rcoh 🎉 👍 Really looking forward to this feature!
😬 That was a bug we recently introduced in Which version of Serverless are you using @rcoh? Can you pull the most recent Let us know if you need help with this or anything else! |
Oh I figured as much. Tried pulled master but it was on my fork 🤦
Just verified the fix and will get started.
What API were you thinking of from the sls side @pmuens? I could imagine a
few options ranging from total magic (binary data just works) to a fairly
accurate mirror of the AWS parameters.
…On Tue, Jul 18, 2017 at 12:27 AM Philipp Muens ***@***.***> wrote:
Started to work on this.
Great @rcoh <https://github.com/rcoh> 🎉 Really looking forward to this
feature!
Was hoping to be able to test my changes to serverless by using npm link
but when I do that, serverless stops working
😬 That was a bug we recently introduced in master, but it was reverted a
few days ago.
Which version of Serverless are you using @rcoh <https://github.com/rcoh>?
Can you pull the most recent master? This should fix the issue.
Let us know if you need help with this or anything else!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2797 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAeFZ2qNHjHCJnTgdzr86L7mBlrpOunCks5sPF5ogaJpZM4K8svv>
.
|
@eraserfusion np, see #4895, though without tests i doubt it'll be merged any time soon :) |
When #4895 got merged, it closed this issue. But as that PR describes, it only solves this issue partially. Can it be reopened until binary support is a full first-class citizen? Or did I miss something and is it actually supported out of the box now? cc @HyperBrain |
@ronkorving Thanks for the hint. @mvayngrib @eraserfusion I'll reopen the issue. Can you elaborate on the merged PR and maybe tell what exactly is needed additionally now to have full support of binary responses? |
@HyperBrain see #2797 (comment) , I don't really have anything to add :) |
@mvayngrib Do you think there's anything against that just being the default setting? |
@ronkorving not sure i understood, which thing being the default setting? |
@mvayngrib Is there any reason not to just have serverless configure support for binary by default, without users having to be explicit about it? It doesn't hurt non-binary responses in any way, does it? I'm a total serverless noob, so I may be misunderstanding some of the philosophies at play here completely. |
Just tried this feature. |
Is there a way for per function binaryMediaTypes? |
Exactly, since one Serverless project might have different functions responding in different formats; text-based formats with MIME type |
Any news regarding setting binaryMediaType on specific API level? or let us on specific Lambda level? |
Having a hard time following this discussion. Question: how can I send binary data from the client, to a websocket endpoint? And back? |
This is a Feature Proposal
Description
Previously, AWS API Gateway did not support binary responses, making it impossible to return images from your serverless API. Now they do (see https://aws.amazon.com/blogs/compute/binary-support-for-api-integrations-with-amazon-api-gateway/). We need to be able to configure HTTP endpoints/events in serverless to use this new functionality.
The text was updated successfully, but these errors were encountered: