Skip to content
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

Update aws-lambda-cpp to 0.2.7 #67

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
Binary file added deps/aws-lambda-cpp-0.2.7.tar.gz
Binary file not shown.
40 changes: 20 additions & 20 deletions deps/patches/aws-lambda-cpp-add-content-type.patch
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
diff --git a/include/aws/lambda-runtime/runtime.h b/include/aws/lambda-runtime/runtime.h
index e14b804..cc1a789 100644
--- a/include/aws/lambda-runtime/runtime.h
+++ b/include/aws/lambda-runtime/runtime.h
@@ -56,6 +56,11 @@ struct invocation_request {
*/
std::string function_arn;

+ /**
+ * The Content-type of the current invocation.
+ */
+ std::string content_type;
+
/**
* Function execution deadline counted in milliseconds since the Unix epoch.
*/
diff --git a/include/aws/http/response.h b/include/aws/http/response.h
index 9b8cbda..be184c1 100644
--- a/include/aws/http/response.h
Expand All @@ -23,7 +7,7 @@ index 9b8cbda..be184c1 100644
inline void set_content_type(char const* ct);
inline std::string const& get_body() const;
+ inline std::string const& get_content_type() const;

private:
response_code m_response_code;
@@ -137,6 +138,12 @@ inline std::string const& response::get_body() const
Expand All @@ -39,15 +23,31 @@ index 9b8cbda..be184c1 100644
inline void response::add_header(std::string name, std::string const& value)
{
std::transform(name.begin(), name.end(), name.begin(), ::tolower);
diff --git a/include/aws/lambda-runtime/runtime.h b/include/aws/lambda-runtime/runtime.h
index de07878..7812ff6 100644
--- a/include/aws/lambda-runtime/runtime.h
+++ b/include/aws/lambda-runtime/runtime.h
@@ -56,6 +56,11 @@ struct invocation_request {
*/
std::string function_arn;

+ /**
+ * The Content-type of the current invocation.
+ */
+ std::string content_type;
+
/**
* Function execution deadline counted in milliseconds since the Unix epoch.
*/
diff --git a/src/runtime.cpp b/src/runtime.cpp
index 08d7014..1cbd6bb 100644
index e0d5cac..383f9b5 100644
--- a/src/runtime.cpp
+++ b/src/runtime.cpp
@@ -275,6 +275,7 @@ runtime::next_outcome runtime::get_next()
@@ -271,6 +271,7 @@ runtime::next_outcome runtime::get_next()
invocation_request req;
req.payload = resp.get_body();
req.request_id = resp.get_header(REQUEST_ID_HEADER);
+ req.content_type = resp.get_content_type();

if (resp.has_header(TRACE_ID_HEADER)) {
req.xray_trace_id = resp.get_header(TRACE_ID_HEADER);
23 changes: 12 additions & 11 deletions deps/patches/aws-lambda-cpp-add-xray-response.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
diff --git a/include/aws/lambda-runtime/runtime.h b/include/aws/lambda-runtime/runtime.h
index 0dc292c..be77d93 100644
index 94e1e22..ee356ff 100644
--- a/include/aws/lambda-runtime/runtime.h
+++ b/include/aws/lambda-runtime/runtime.h
@@ -85,6 +85,11 @@ private:
*/
bool m_success;

+ /**
+ * The serialized XRay response header.
+ */
Expand All @@ -28,7 +28,7 @@ index 0dc292c..be77d93 100644
+ m_success(success),
+ m_xray_response(xray_response)
+ {}

/**
* Create a successful invocation response with the given payload and content-type.
@@ -111,7 +118,7 @@ public:
Expand All @@ -37,7 +37,7 @@ index 0dc292c..be77d93 100644
*/
- static invocation_response failure(std::string const& error_message, std::string const& error_type);
+ static invocation_response failure(std::string const& error_message, std::string const& error_type, std::string const& xray_response);

/**
* Get the MIME type of the payload.
@@ -127,6 +134,11 @@ public:
Expand All @@ -50,23 +50,23 @@ index 0dc292c..be77d93 100644
+ */
+ std::string const& get_xray_response() const { return m_xray_response; }
};

struct no_result {
diff --git a/src/runtime.cpp b/src/runtime.cpp
index e2ee7cd..d895c4b 100644
index 9175084..230ce6f 100644
--- a/src/runtime.cpp
+++ b/src/runtime.cpp
@@ -337,6 +337,7 @@ runtime::post_outcome runtime::do_post(
@@ -333,6 +333,7 @@ runtime::post_outcome runtime::do_post(
headers = curl_slist_append(headers, ("content-type: " + handler_response.get_content_type()).c_str());
}

+ headers = curl_slist_append(headers, ("lambda-runtime-function-xray-error-cause: " + handler_response.get_xray_response()).c_str());
headers = curl_slist_append(headers, "Expect:");
headers = curl_slist_append(headers, "transfer-encoding:");
headers = curl_slist_append(headers, get_user_agent_header().c_str());
@@ -511,13 +512,15 @@ invocation_response invocation_response::success(std::string const& payload, std
headers = curl_slist_append(headers, m_user_agent_header.c_str());
@@ -507,13 +508,15 @@ invocation_response invocation_response::success(std::string const& payload, std
}

AWS_LAMBDA_RUNTIME_API
-invocation_response invocation_response::failure(std::string const& error_message, std::string const& error_type)
+invocation_response invocation_response::failure(std::string const& error_message, std::string const& error_type, std::string const& xray_response)
Expand All @@ -80,3 +80,4 @@ index e2ee7cd..d895c4b 100644
+
return r;
}

36 changes: 0 additions & 36 deletions deps/patches/aws-lambda-cpp-make-lto-optional.patch

This file was deleted.

This file was deleted.

Loading