diff --git a/elixir_runtime/README.md b/elixir_runtime/README.md index 337bb8f..fab64f6 100644 --- a/elixir_runtime/README.md +++ b/elixir_runtime/README.md @@ -66,7 +66,7 @@ to read: ```elixir defmodule HelloWorld do - def my_hello_world_handler(request, context) + def hello_world(request, context) when is_map(request) and is_map(context) do """ Hello World! @@ -103,7 +103,7 @@ cli. Using the CLI would look like the following: > aws lambda create-function \ --region $AWS_REGION \ --function-name HelloWorld \ - --handler Elixir.HelloWorld:my_hello_world_handler \ + --handler Elixir.HelloWorld:hello_world \ --role $ROLE_ARN \ --runtime provided \ --zip-file fileb://./lambda.zip @@ -116,14 +116,19 @@ Invoking from the CLI would look like this: > aws lambda invoke \ --function-name HelloWorld \ --region $AWS_REGION \ - --lag-type TAIL \ + --log-type Tail \ --payload '{"msg": "a fake request"}' \ outputfile.txt ... > cat outputfile.txt +ok +``` + +The LogResult returns a Base64 Encoded message. When decoded this would have +``` Hello World! Request: %{ "msg" => "a fake request" } Context: %{ ... } ``` - +within it including other log messages. diff --git a/elixir_runtime/lib/mix/tasks/bootstrap.ex b/elixir_runtime/lib/mix/tasks/bootstrap.ex index 736589b..51ab661 100644 --- a/elixir_runtime/lib/mix/tasks/bootstrap.ex +++ b/elixir_runtime/lib/mix/tasks/bootstrap.ex @@ -9,7 +9,7 @@ defmodule Mix.Tasks.Bootstrap do use Mix.Task - @runtime_libs "elixir_runtime-0.1.0/priv" + @runtime_libs "aws_lambda_elixir_runtime-0.1.0/priv" @shortdoc "Generate a bootstrap script for the project" def run(_) do @@ -40,6 +40,7 @@ defmodule Mix.Tasks.Bootstrap do \# So that distillery doesn't try to write any files export RELEASE_READ_ONLY=true + export LD_PRELOAD=$BASE/lib/#{@runtime_libs}/libcrypto.so.10 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$BASE/lib/#{@runtime_libs} $EXE foreground diff --git a/elixir_runtime/priv/libcrypto.so.10 b/elixir_runtime/priv/libcrypto.so.10 new file mode 100755 index 0000000..9286666 Binary files /dev/null and b/elixir_runtime/priv/libcrypto.so.10 differ diff --git a/examples/hello_world/lib/hello_world.ex b/examples/hello_world/lib/hello_world.ex index d1d75f3..220edd5 100644 --- a/examples/hello_world/lib/hello_world.ex +++ b/examples/hello_world/lib/hello_world.ex @@ -17,7 +17,7 @@ defmodule HelloWorld do def hello_world(request, context) when is_map(request) and is_map(context) do """ Hello World! - Got reqeust #{Kernel.inspect(request)} + Got request #{Kernel.inspect(request)} Got Context #{Kernel.inspect(context)} """ |> Logger.info()