Skip to content

Commit

Permalink
Revert "Bump lambda_http dependency of aws-smithy-http-server to …
Browse files Browse the repository at this point in the history
…0.8.0 (#2685)" (#2690)

This reverts commit 04db5e3.

This is a breaking change that needs to wait to be merged in until the
next breaking release.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
  • Loading branch information
david-perez committed May 22, 2023
1 parent 0070117 commit fe9e760
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 20 deletions.
6 changes: 0 additions & 6 deletions CHANGELOG.next.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,3 @@ message = "Implement `Ord` and `PartialOrd` for `DateTime`."
author = "henriiik"
references = ["smithy-rs#2653", "smithy-rs#2656"]
meta = { "breaking" = false, "tada" = false, "bug" = false }

[[smithy-rs]]
message = "Bump dependency on `lambda_http` by `aws-smithy-http-server` to 0.8.0. This version of `aws-smithy-http-server` is only guaranteed to be compatible with 0.8.0, or semver-compatible versions of 0.8.0 of the `lambda_http` crate. It will not work with versions prior to 0.8.0 _at runtime_, making requests to your smithy-rs service unroutable, so please make sure you're running your service in a compatible configuration"
author = "david-perez"
references = ["smithy-rs#2676", "smithy-rs#2685"]
meta = { "breaking" = true, "tada" = false, "bug" = false }
2 changes: 1 addition & 1 deletion examples/pokemon-service-lambda/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ tracing = "0.1"
# `aws-smithy-http-server` is only guaranteed to be compatible with this
# version of `lambda_http`, or semver-compatible versions of this version.
# Depending on other versions of `lambda_http` may not work.
lambda_http = "0.8.0"
lambda_http = "0.7.3"

# Local paths
aws-smithy-http-server = { path = "../../rust-runtime/aws-smithy-http-server", features = ["aws-lambda"] }
Expand Down
7 changes: 6 additions & 1 deletion rust-runtime/aws-smithy-http-server-python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ hyper = { version = "0.14.20", features = ["server", "http1", "http2", "tcp", "s
tls-listener = { version = "0.7.0", features = ["rustls", "hyper-h2"] }
rustls-pemfile = "1.0.1"
tokio-rustls = "0.24.0"
lambda_http = { version = "0.8.0" }
lambda_http = { version = "0.7.1" }
# There is a breaking change in `lambda_runtime` between `0.7.0` and `0.7.1`,
# and `lambda_http` depends on `0.7` which by default resolves to `0.7.1` but in our CI
# we are running `minimal-versions` which downgrades `lambda_runtime` to `0.7.0` and fails to compile
# because of the breaking change. Here we are forcing it to use `lambda_runtime = 0.7.1`.
lambda_runtime = { version = "0.7.1" }
num_cpus = "1.13.1"
parking_lot = "0.12.1"
pin-project-lite = "0.2"
Expand Down
4 changes: 2 additions & 2 deletions rust-runtime/aws-smithy-http-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ futures-util = { version = "0.3.16", default-features = false }
http = "0.2"
http-body = "0.4"
hyper = { version = "0.14.12", features = ["server", "http1", "http2", "tcp", "stream"] }
lambda_http = { version = "0.8.0", optional = true }
mime = "0.3.4"
lambda_http = { version = "0.7.1", optional = true }
mime = "0.3"
nom = "7"
pin-project-lite = "0.2"
once_cell = "1.13"
Expand Down
16 changes: 6 additions & 10 deletions rust-runtime/aws-smithy-http-server/src/routing/lambda_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ where
///
/// [API Gateway Stage]: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-stages.html
fn convert_event(request: Request) -> HyperRequest {
let raw_path: &str = request.extensions().raw_http_path();
let path: &str = request.uri().path();
let raw_path = request.raw_http_path();
let (mut parts, body) = request.into_parts();
let mut path = String::from(parts.uri.path());

let (parts, body) = if !raw_path.is_empty() && raw_path != path {
let mut path = raw_path.to_owned(); // Clone only when we need to strip out the stage.
let (mut parts, body) = request.into_parts();
if !raw_path.is_empty() && raw_path != path {
path = raw_path;

let uri_parts: uri::Parts = parts.uri.into();
let path_and_query = uri_parts
Expand All @@ -81,11 +81,7 @@ fn convert_event(request: Request) -> HyperRequest {
.path_and_query(path)
.build()
.expect("unable to construct new URI");

(parts, body)
} else {
request.into_parts()
};
}

let body = match body {
lambda_http::Body::Empty => hyper::Body::empty(),
Expand Down

0 comments on commit fe9e760

Please sign in to comment.