vapor-community / vapor-aws-lambda-runtime Goto Github PK
View Code? Open in Web Editor NEWRun your Vapor api server on AWS Lambda using the official Swift Server runtime.
License: Apache License 2.0
Run your Vapor api server on AWS Lambda using the official Swift Server runtime.
License: Apache License 2.0
Experimenting with this, and setting up a vapor service using pulumi scripts in aws.
In terms of what's needed in the swift vapor code, is it enough to just do this here:
app.servers.use(.lambda)
Or is there anything else I would need to do per endpoint, to get this working?
@tanner0101 suggested:
Creating a community package that follow's Vapor 4's provider pattern could be a good next step
Something like:
import Vapor
import Lambda
let app = Application(...)
defer { app.shutdown() }
app.lambda.enable()
try app.run()
Have managed to get a nice API proof of concept for JSON responses, but having a hard time doing it for protobuf data.
Already wrote the code to have my vapor API return protobuf data with the appropriate contentType of "application/protobuf" based on whether the client sends an Accept header with application/protobuf, all that works when I run my vapor API locally (both running via docker or just swift run).
But trying to make use of that when the service is running in AWS doesn't work.
After a bit of poking around, I've figured out that the aws RestApi declaration in AWS needed a declaration for "binary_media_types".
For example:
binary_media_types=["application/protobuf"]
But it still does not work.
As far as I can tell, it might just require a modification to check the contentType for application/protobuf before creating the APIGateway Response, in these files here:
Just wanted to raise it as a possible feature request, think it would be pretty cool.
If its already possible to get this working somehow, then I would greatly appreciate any hints or information that might help.
Thanks for making such an awesome library !
The swift-was-lambda-runtime project has added the ability to run a local lambda server by setting the LOCAL_LAMBDA_SERVER_ENABLED environment variable to "true." I tried this with the Vapor integration and it does not seem to work.
It would be nice if this worked so I could run / debug inside Xcode on my Mac.
If you do not have time to do it, I have looked a little and am not sure where to look. Do you know where I would start to look into fixing this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.