Skip to content

CI/CD fixes #994

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

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
5 changes: 5 additions & 0 deletions .github/actions/rust-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ inputs:
toolchain:
required: true
description: "the Rust toolchain to use"
run-tests:
required: true
default: true
description: "whether to run tests in addition to building"

runs:
using: "composite"
Expand All @@ -22,5 +26,6 @@ runs:
run: cargo build --all-features --verbose --package ${{ inputs.package }}

- name: Run tests
if: ${{ inputs.run-tests }}
shell: bash
run: cargo test --all-features --verbose --package ${{ inputs.package }}
3 changes: 3 additions & 0 deletions .github/workflows/build-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ jobs:
with:
package: lambda-integration-tests
toolchain: ${{ matrix.toolchain}}
# the tests will generally fail in ci since they make a network call to a real endpoint,
# this step is just designed to make sure they build successfully
run-tests: false
16 changes: 10 additions & 6 deletions lambda-runtime/src/layers/api_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ where
#[cfg(debug_assertions)]
if req.parts.status.is_server_error() {
error!("Lambda Runtime server returned an unexpected error");
return RuntimeApiResponseFuture::Ready(Some(Err(req.parts.status.to_string().into())));
return RuntimeApiResponseFuture::Ready(Box::new(Some(Err(req.parts.status.to_string().into()))));
}

// Utility closure to propagate potential error from conditionally executed trace
Expand All @@ -98,22 +98,23 @@ where
};
if let Err(err) = trace_fn() {
error!(error = ?err, "Failed to parse raw JSON event received from Lambda. The handler will not be called. Log at TRACE level to see the payload.");
return RuntimeApiResponseFuture::Ready(Some(Err(err)));
return RuntimeApiResponseFuture::Ready(Box::new(Some(Err(err))));
};

let request_id = req.context.request_id.clone();
let lambda_event = match deserializer::deserialize::<EventPayload>(&req.body, req.context) {
Ok(lambda_event) => lambda_event,
Err(err) => match build_event_error_request(&request_id, err) {
Ok(request) => return RuntimeApiResponseFuture::Ready(Some(Ok(request))),
Ok(request) => return RuntimeApiResponseFuture::Ready(Box::new(Some(Ok(request)))),
Err(err) => {
error!(error = ?err, "failed to build error response for Lambda Runtime API");
return RuntimeApiResponseFuture::Ready(Some(Err(err)));
return RuntimeApiResponseFuture::Ready(Box::new(Some(Err(err))));
}
},
};

// Once the handler input has been generated successfully, the
// Once the handler input has been generated successfully, pass it through to inner services
// allowing processing both before reaching the handler function and after the handler completes.
let fut = self.inner.call(lambda_event);
RuntimeApiResponseFuture::Future(fut, request_id, PhantomData)
}
Expand Down Expand Up @@ -141,7 +142,10 @@ pub enum RuntimeApiResponseFuture<F, Response, BufferedResponse, StreamingRespon
StreamError,
)>,
),
Ready(Option<Result<http::Request<Body>, BoxError>>),
/// This variant is used in case the invocation fails to be processed into an event.
/// We box it to avoid bloating the size of the more likely variant, which is
/// the future that drives event processing.
Ready(Box<Option<Result<http::Request<Body>, BoxError>>>),
}

impl<F, Response, BufferedResponse, StreamingResponse, StreamItem, StreamError> Future
Expand Down
Loading