tonisuter / aws-lambda-swift Goto Github PK
View Code? Open in Web Editor NEWA custom AWS Lambda Runtime for Swift
A custom AWS Lambda Runtime for Swift
Looks like it is possible to move the bootstrap
script into the layer: https://docs.aws.amazon.com/lambda/latest/dg/runtimes-walkthrough.html
From https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html:
Create a context object – Create an object with context information from environment variables and headers in the API response.
Hi Toni, great project! I found it through your post on the Swift forums.
I modified your project to write my own little function. Since my function uses Swift 5 features, I switched the Docker image to codevapor/swift:5.0.
Everything seemed to work, but when I tested my function on AWS, it failed with:
error while loading shared libraries: libswiftDispatch.so: cannot open shared object file: No such file or directory
It looks like the source of this error is that the names of one or more shared libraries changed in Swift 5, e.g. libdispatch.so
is now called libswiftDispatch.so
. So I need to update the list of shared libraries in the Makefile. Can I ask how you generated this list?
Running ldd [path_to_my_binary]
on Linux seems to be an option to get a list of the shared libraries loaded by an executable, but I wanted to ask if you used a different option.
Thanks and happy holidays!
PS: Don't let me stop you from enjoying your holidays. This isn't urgent.
Where is your docker file so we can create this runtime ?
Or, can you post the runtime zip somewhere others can just download it ?
A great project. I love Swift and AWS and I am looking to combine the two with your amazing work and hoping to contribute in the future if I can.
I do have an issue when creating the swift-runtime zip file. I do feel that I am getting a user side error when running the make package_layer
command. I receive the following errors:
cp: cannot stat '/lib/x86_64-linux-gnu/libcrypto.so.1.0.0': No such file or directory cp: cannot stat '/lib/x86_64-linux-gnu/libssl.so.1.0.0': No such file or directory cp: cannot stat '/usr/lib/x86_64-linux-gnu/libicudata.so.55': No such file or directory cp: cannot stat '/usr/lib/x86_64-linux-gnu/libicui18n.so.55': No such file or directory cp: cannot stat '/usr/lib/x86_64-linux-gnu/libicuuc.so.55': No such file or directory cp: cannot stat '/usr/lib/x86_64-linux-gnu/libidn.so.11': No such file or directory make: *** [package_layer] Error 1
I do feel like I am missing those libraries locally but can't seem to figure out the installion of them. Any help will be appreciate. (I do feel like this is a beginner issue so apologies in advance.)
From https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html:
Handle errors – If an error occurs, call the invocation error API.
From https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html:
Propagate the tracing header – Get the X-Ray tracing header from the Lambda-Runtime-Trace-Id header in the API response. Set the _X_AMZN_TRACE_ID environment variable with the same value for the X-Ray SDK to use.
This is a lambda function with proxy integration connected to an API Gateway.
It randomly crashes with this log:
18:33:58
START RequestId: d78628da-a0c9-4e39-be97-5c0a604dadf9 Version: $LATEST
18:33:58
Fatal error: Error raised at top level: AWSLambdaSwift.RuntimeError.endpointError("The operation could not be completed"): file /home/buildnode/jenkins/workspace/oss-swift-5.0-package-linux-ubuntu-18_04/swift/stdlib/public/core/ErrorType.swift, line 200
18:33:58
Current stack trace:
18:33:58
0 libswiftCore.so 0x00007fefdf1387a0 _swift_stdlib_reportFatalErrorInFile + 115
18:33:58
1 libswiftCore.so 0x00007fefdf0739cc <unavailable> + 3463628
18:33:58
2 libswiftCore.so 0x00007fefdf073abe <unavailable> + 3463870
18:33:58
3 libswiftCore.so 0x00007fefdee6f31a <unavailable> + 1348378
18:33:58
4 libswiftCore.so 0x00007fefdf047ab2 <unavailable> + 3283634
18:33:58
5 libswiftCore.so 0x00007fefdeec4d6e <unavailable> + 1699182
18:33:58
6 myFunc 0x00007fefdfd75f80 <unavailable> + 335744
18:33:58
7 libc.so.6 0x00007fefdd7eeab0 __libc_start_main + 231
18:33:58
8 myFunc 0x00007fefdfd34e5a <unavailable> + 69210
It seems to have something to do with URLSession
on Linux. I have tried to print more info, but all I could get was: Foundation.URLError(_nsError: The operation could not be completed
.
Also, both HTTPResponse and data are empty.
@tonisuter thoughts?
Hi,
I was wondering, if it would make sense to replace the current http client implementation based on URLSession and FoundationNetworking with an implementation based on
https://github.com/swift-server/async-http-client/
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.