Skip to content

Use lambda_http 0.5 instead of fork #13

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

Closed
wants to merge 1 commit into from
Closed

Conversation

aig787
Copy link
Contributor

@aig787 aig787 commented Feb 23, 2022

This PR uses the official lambda_http release 0.5 which fixes awslabs/aws-lambda-rust-runtime#274 and updates the warp adapter to implement tower::Service directly now that the lambda http handler has been removed.

Copy link
Owner

@aslamplr aslamplr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this awesome PR ❤️! And it looks good to me!

@@ -5,11 +5,11 @@ use warp::Filter;
async fn main() -> Result<()> {
// Your warp routes (filters)
let routes = warp::any().map(|| "Hello, World!");
// Convert them to a warp service (a tower service implmentation)
// Convert them to a warp service (a tower service implementation)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

// using `warp::service()`
let warp_service = warp::service(routes);
// The warp_lambda::run() function takes care of invoking the aws lambda runtime for you
warp_lambda::run(warp_service)
.await
.map_err(|err| anyhow!("An error occured `{:#?}`", err))
.map_err(|err| anyhow!("An error occurred `{:#?}`", err))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 😅

@@ -2,50 +2,66 @@ use core::future::Future;
use std::convert::Infallible;
use std::pin::Pin;

pub use lamedh_http as lambda_http;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally, we are able to get rid of this!

}

fn call(&mut self, req: Request) -> Self::Future {
let query_params = req.query_string_parameters();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@aslamplr
Copy link
Owner

aslamplr commented Apr 20, 2022

Created PR (#15) for initiating CI build on commit de48e27

Update: CI passing ✅

@aslamplr
Copy link
Owner

aslamplr commented Apr 20, 2022

Resolved ✅

Error message when compiling: `error[E0599]: no method named `ready` found for type parameter `F` in the current scope`
`cargo check` and `cargo build` fails in local (Rust version `1.60.0`)

Detailed Error

error[E0599]: no method named `ready` found for type parameter `F` in the current scope
   --> /Users/aslam/.cargo/registry/src/git.colasdn.top-1ecc6299db9ec823/lambda_runtime-0.5.1/src/lib.rs:130:37
    |
130 |             let req = match handler.ready().await {
    |                                     ^^^^^ method not found in `F`

Screenshot 2022-04-20 at 7 02 23 PM

Screenshot 2022-04-20 at 7 05 14 PM

Resolution: remove Cargo.lock before compiling

@aslamplr
Copy link
Owner

Merged to main in f753804

@aslamplr aslamplr closed this Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Netlify's Open Lambda Rust Runtime Distribution
3 participants