Skip to content
Merged
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: 2 additions & 11 deletions packaging/packager
Original file line number Diff line number Diff line change
Expand Up @@ -171,20 +171,11 @@ exec \$LAMBDA_TASK_ROOT/lib/$PKG_LD --library-path \$LAMBDA_TASK_ROOT/lib \$LAMB
EOF
)

bootstrap_script_no_libc=$(cat <<EOF
#!/bin/bash
set -euo pipefail
export AWS_EXECUTION_ENV=lambda-cpp
export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$LAMBDA_TASK_ROOT/lib
exec \$LAMBDA_TASK_ROOT/bin/$PKG_BIN_FILENAME \${_HANDLER}
EOF
)

cp "$PKG_BIN_PATH" "$PKG_DIR/bin"
if [[ $INCLUDE_LIBC == true ]]; then
cp "$PKG_BIN_PATH" "$PKG_DIR/bin"
echo -e "$bootstrap_script" > "$PKG_DIR/bootstrap"
else
echo -e "$bootstrap_script_no_libc" > "$PKG_DIR/bootstrap"
cp "$PKG_BIN_PATH" "$PKG_DIR/bootstrap"
fi
chmod +x "$PKG_DIR/bootstrap"
# some shenanigans to create the right layout in the zip file without extraneous directories
Expand Down
9 changes: 3 additions & 6 deletions tests/resources/lambda_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,9 @@ int main(int argc, char* argv[])
handlers.emplace("binary_response", binary_response);
handlers.emplace("crash_backtrace", crash_backtrace);

if (argc < 2) {
aws::logging::log_error("lambda_fun", "Missing handler argument. Exiting.");
return -1;
}

auto it = handlers.find(argv[1]);
// Read the handler from the environment variable
const char* handler_name = std::getenv("_HANDLER");
auto it = handlers.find(handler_name == nullptr ? "" : handler_name);
if (it == handlers.end()) {
aws::logging::log_error("lambda_fun", "Handler %s not found. Exiting.", argv[1]);
return -2;
Expand Down