Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions elixir_runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down Expand Up @@ -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
Expand All @@ -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.
3 changes: 2 additions & 1 deletion elixir_runtime/lib/mix/tasks/bootstrap.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Binary file added elixir_runtime/priv/libcrypto.so.10
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/hello_world/lib/hello_world.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down