-
Notifications
You must be signed in to change notification settings - Fork 21
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
Aws lambda runtime support #101
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks too simple to be true... :) I don't know the internals well enough to be able to comment much further than the suggestion I've put but thought I would set the ball rolling. @koterpillar thoughts on the PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how simple this is. I hope I'll get time to test some of our existing projects with this soon (or maybe @axman6?).
I note that the README, documentation and changelog are unchanged, we'll need to work on that - I think I have a good understanding of how the new plugin works, let me know if you need help with this.
events: | ||
- http: | ||
path: hello/{name} | ||
method: get | ||
|
||
subdir: | ||
handler: subdir/subtest.main | ||
handler: src/SubDir/SubModule.handler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original version supported multiple Stack projects. If this is removed, there's no reason to include this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually yes, because this is what the runtime dispatcher uses for knowing which handler to use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't for the life of me get this to work, I keep getting errors about not being able to find an executable named handler
.
@@ -17,6 +17,7 @@ dependencies: | |||
- amazonka-core | |||
- amazonka-kinesis | |||
- amazonka-s3 | |||
- aws-lambda-haskell-runtime >= 2.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noting that this has to be in stable Stackage before this PR can be merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, working on it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As soon as this gets accepted, we will have it on LTS-13.25 commercialhaskell/lts-haskell#236
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged! This is now in LTS-13.27: https://www.stackage.org/lts-13.27/package/aws-lambda-haskell-runtime-2.0.1
serverless-plugin/index.js
Outdated
@@ -299,15 +297,15 @@ class ServerlessPlugin { | |||
|
|||
const res = this.runStack(directory, buildCommand); | |||
|
|||
// Copy the executable to the destination directory | |||
// Copy the executable and runtime to the destination directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the runtime copied - is this comment left around from some removed changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks! 03b49e1
I am having problems running the integration tests on my machine.
Does the |
I just pushed a fix to 1cf14c3 , the proper executable wasn't being copied. Try the invoke local now :) |
serverless-plugin/index.js
Outdated
@@ -303,11 +301,12 @@ class ServerlessPlugin { | |||
const stackInstallRoot = this.runStackOutput( | |||
directory, | |||
[ | |||
'--docker', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already a mechanism for disabling Docker (search the file for localRun
and docker.skip
), please use that instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, it always skips it, that's why I had to manually add it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you talking about the integration tests? They also test "disable Docker completely" mode, not sure how that plays with the new invoke local
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new invoke local
relies on always running Docker, so it won't work with that.
Still, I'm talking about running sls invoke local
as it is. With the --docker
flag, or without it, the result is the same one, the wrong executable gets copied (the one that is not built with Docker).
I'm currently trying to fix the tests, but there are two main issues:
I wanted to solve this with the |
That shouldn't be a problem, the image will be added soon enough. You can override the resolver for now, and remove 12- tests. |
I'm trying to fix Travis in order to make this PR mergeable, but some jobs are failing with this message:
Any idea what can I do in order to fix this? |
I've restarted everything. Sorry, I don't think there's a way to do anything on Travis if you're not a member of the repository. |
Although if all the jobs have failed, you can do a trivial amend and force push to start them all again. |
Just to see if it fixes Travis' tests
Looks like whatever process Stack had for the Docker image has failed: commercialhaskell/stack#4945 I'm wondering about the quality of |
@koterpillar from my experience, |
FYI, it looks like the docker images for |
I'm trying to test this out and failing when going through the README - when running
Any idea what's going on? |
This is weird, because the runtime process expects that variable to be set, which is where the runtime then gets the events and posts the results, it is weird, because when I was working on the PR it was working 🤔 |
Edit: Looks like I probably am not using the updated serverless-haskell npm module. I decided to bypass the local invocation and see if I could run things on AWS, and now I'm running into even more fun problems. I can upload the handler (use the example project as my template) with
but once I try to use "Handler serverless-haskell-example.bootstrap does not exist on project"
Error --------------------------------------------------
Invoked function failed
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: darwin
Node Version: 12.6.0
Serverless Version: 1.48.2
Enterprise Plugin Version: 1.3.2
Platform SDK Version: 2.0.4
|
Looks like we're definitely going to need some updates to the README with this PR. |
Hi all, is the state of this PR the failing integration tests on travis or are there other reasons? Anyway, this is just a side note, the real question is: What is the state here and what has to be done to get here some progress :D ? |
My understanding is that this current PR is a significant change to the way that the project is structured and operates. I don't think any of us at SEEK have had the time to sit down and work through the implications of those changes and make sure everything's working properly. We're using this in production for several services, many of which would probably benefit from the reduced latency and resource requirements, but just don't have time to make the changes - maybe at our next hackathon we'll get together and sort it out. |
Closed by #130, turns out we didn't have to change the interface this much. |
This PR is a continuation of #82 , I decided to start from scratch because
master
had advanced a lot.These changes allow writing handlers with the v2 version of the runtime.
This version packages the runtime together with the user's project, so it is much faster than before:
~120ms
to~60ms
~12ms
to~0.9ms
Note: These benchmarks were done with a Hello World lambda function
Regarding integration tests, I have modified the integration tests so they test using the runtime. Everything works except local invocation, as I'm having a weird error going on: