wai-lambda icon indicating copy to clipboard operation
wai-lambda copied to clipboard

Use hal and custom runtime instead of node.js

Open purefn opened this issue 6 years ago • 4 comments

What are your thoughts on switching from using a node.js runtime environment to using a custom environment with hal instead?

purefn avatar Mar 21 '19 15:03 purefn

I didn't know about hal, thanks for sharing! I'll have a look this weekend.

nmattia avatar Mar 21 '19 17:03 nmattia

This is very interesting, I didn't know you could provide custom runtimes: https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html

I wonder if using hal would buy us anything, since we need the full input request as opposed to just the request body (I'm sure there's a way of accessing that with hal but couldn't find it). Also the wai-lambda code is much shorter so I do wonder if this wouldn't be overkill. Another solution would be for wai-lambda to provide a function similar to pureRuntime that turns the executable into a "runtime". ll play with both solutions and see what the pros and cons are. Do you have any experience using it @purefn ? Anything to report?

nmattia avatar Mar 24 '19 19:03 nmattia

I haven't used It in anger yet, I've just played with it a bit. I think the mail benefit would be getting rid of any JS code in favor or pure Haskell. It should result in easier to maintain and understand code and better performance.

I'm not sure what you mean about not having full access to the Lambda request. Any of theWithContext or the readerTRuntime function allow you to read it out of the environment.

purefn avatar Mar 24 '19 22:03 purefn

You have probably seen this already but you can also use the Haskell AWS Lambda Runtime https://medium.com/the-theam-journey/getting-started-with-the-haskell-aws-lambda-runtime-951b2322c7a3.

Zenleaf avatar Apr 23 '19 05:04 Zenleaf