Closed OZoneGuy closed 1 year ago
Can you include full logs (not just the span names)?
tracing_subscriber::fmt::init()
+ RUST_LOG=debug
It looks like you're getting timeouts and then a retry. Is there a reason you think credentials are to blame here? Seems like your passing static credentials into the client.
Added logs. Was following the template and didn't get any logs from RUST_LOG='aws_smithy_http_tower::dispatch=trace,aws_smithy_http::middleware=trace' cargo run
.
That appears to be a networking issue rather than a credentials issue. It seems like it's making a request to S3 and not getting a response within the default 3.1 second timeout.
So what solution is there? I can access S3 using the command line, and I was able to interact with it using the JS SDK. So, is this a rust issue or what?
I tried the typescript SDK again from the same machine on the same network, and it works without an issue. I can see it fails after it tries to resolve the host. Is it failing to resolve the s3 host somehow?
Added logs. Was following the template and didn't get any logs from
RUST_LOG='aws_smithy_http_tower::dispatch=trace,aws_smithy_http::middleware=trace' cargo run
.
It looks like the instructions in the bug template were wrong. Sorry about that. Make sure tracing-subscriber
has the env-filter
feature enabled, and then it should be: RUST_LOG=debug cargo run
.
So what solution is there? I can access S3 using the command line, and I was able to interact with it using the JS SDK. So, is this a rust issue or what?
I tried your code locally and wasn't able to reproduce the issue, although the list_objects_v2
without a bucket did fail in a different way (it got a ListBuckets
response from S3). This is an unrelated issue.
I can't explain why it works for you with JS but not with Rust without more information about your environment. It seems like there's something about your host that is preventing the default Rustls hyper connector from making outbound HTTP calls.
Have you tried making a HTTP request to anything in Rust using the hyper-rustls
and hyper
crates? Does that work?
I tried making https requests using reqwest
and the hyper-rustls
crates. Both work. But when I try to make the request using the s3 library, it doesn't work...
let https = hyper_rustls::HttpsConnectorBuilder::new()
.with_native_roots()
.https_only()
.enable_http1()
.build();
let client: Client<_, hyper::Body> = Client::builder().build(https);
let req = client
.get(Uri::from_static(
"https://remote-data-sync.s3.us-east-2.amazonaws.com",
))
.await;
dbg!(req); // suceeds to connect
let s3_client = create_s3_client(&secrets).await;
let objects = s3_client
.list_objects_v2()
.bucket(&config.bucket_name)
.send()
.await;
dbg!(objects); // fails to connect
In your example you connected to us-east-2 but the logs are pointing to us east 1 — what happens if you change the client region to us-east-2?
Same result. Here are the updated logs:
[2023-08-22T02:47:36Z DEBUG hyper_rustls::config] with_native_roots processed 144 valid and 0 invalid certs
[2023-08-22T02:47:36Z DEBUG hyper::client::connect::dns] resolving host="remote-data-sync.s3.us-east-2.amazonaws.com"
[2023-08-22T02:47:41Z DEBUG hyper::client::connect::http] connecting to 52.219.141.90:443
[2023-08-22T02:47:41Z DEBUG hyper::client::connect::http] connected to 52.219.141.90:443
[2023-08-22T02:47:41Z DEBUG rustls::client::hs] No cached session for DnsName("remote-data-sync.s3.us-east-2.amazonaws.com")
[2023-08-22T02:47:41Z DEBUG rustls::client::hs] Not resuming any session
[2023-08-22T02:47:41Z DEBUG rustls::client::hs] ALPN protocol is None
[2023-08-22T02:47:41Z DEBUG rustls::client::hs] Using ciphersuite TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
[2023-08-22T02:47:41Z DEBUG rustls::client::tls12] ECDHE curve is ECParameters { curve_type: NamedCurve, named_group: secp256r1 }
[2023-08-22T02:47:41Z DEBUG rustls::client::tls12] Server DNS name is DnsName("remote-data-sync.s3.us-east-2.amazonaws.com")
[2023-08-22T02:47:42Z DEBUG hyper::proto::h1::io] flushed 69 bytes
[2023-08-22T02:47:42Z DEBUG hyper::proto::h1::io] parsed 7 headers
[2023-08-22T02:47:42Z DEBUG hyper::proto::h1::conn] incoming body is chunked encoding
[src/main.rs:132] req = Ok(
Response {
status: 403,
version: HTTP/1.1,
headers: {
"x-amz-bucket-region": "us-east-2",
"x-amz-request-id": "2QK8MEJAPYJ2CT9E",
"x-amz-id-2": "t8TM3hV78ZW5+0g+b7OvbvbbYKUozqHlK1MdkVEgqtXEfs+YZcQwhZXHRrg3K+uoEoU2Aw9Edtc=",
"content-type": "application/xml",
"transfer-encoding": "chunked",
"date": "Tue, 22 Aug 2023 02:47:41 GMT",
"server": "AmazonS3",
},
body: Body(
Streaming,
),
},
)
[2023-08-22T02:47:42Z DEBUG reqwest::connect] starting new connection: https://api.ipify.org/
[2023-08-22T02:47:42Z DEBUG hyper::client::connect::dns] resolving host="api.ipify.org"
[2023-08-22T02:47:42Z DEBUG rustls::common_state] Sending warning alert CloseNotify
[2023-08-22T02:47:47Z DEBUG hyper::client::connect::http] connecting to 64.185.227.156:443
[2023-08-22T02:47:47Z DEBUG hyper::client::connect::http] connected to 64.185.227.156:443
[2023-08-22T02:47:47Z DEBUG hyper::proto::h1::io] flushed 52 bytes
[2023-08-22T02:47:47Z DEBUG hyper::proto::h1::io] parsed 6 headers
[2023-08-22T02:47:47Z DEBUG hyper::proto::h1::conn] incoming body is content-length (14 bytes)
[2023-08-22T02:47:47Z DEBUG hyper::proto::h1::conn] incoming body completed
[2023-08-22T02:47:47Z DEBUG hyper::client::pool] pooling idle connection for ("https", api.ipify.org)
[2023-08-22T02:47:47Z DEBUG misc_server] Got server IP
[2023-08-22T02:47:47Z DEBUG aws_config::fs_util] loaded home directory src="HOME"
[2023-08-22T02:47:47Z DEBUG aws_config::profile::parser::source] load_config_file; file=Default(Config)
[2023-08-22T02:47:47Z DEBUG aws_config::profile::parser::source] performing home directory substitution home="/home/omar" path="~/.aws/config"
[2023-08-22T02:47:47Z DEBUG aws_config::profile::parser::source] home directory expanded before="~/.aws/config" after="/home/omar/.aws/config"
[2023-08-22T02:47:47Z DEBUG aws_config::profile::parser::source] config file loaded path=Some("/home/omar/.aws/config") size=43
[2023-08-22T02:47:47Z DEBUG aws_config::profile::parser::source] load_config_file; file=Default(Credentials)
[2023-08-22T02:47:47Z DEBUG aws_config::profile::parser::source] performing home directory substitution home="/home/omar" path="~/.aws/credentials"
[2023-08-22T02:47:47Z DEBUG aws_config::profile::parser::source] home directory expanded before="~/.aws/credentials" after="/home/omar/.aws/credentials"
[2023-08-22T02:47:47Z DEBUG aws_config::profile::parser::source] config file loaded path=Some("/home/omar/.aws/credentials") size=116
[2023-08-22T02:47:47Z DEBUG hyper_rustls::config] with_native_roots processed 144 valid and 0 invalid certs
[2023-08-22T02:47:47Z DEBUG aws_sdk_s3::config] using retry strategy with partition 's3'
[2023-08-22T02:47:47Z DEBUG aws_smithy_runtime::client::orchestrator] invoke; service=s3 operation=ListObjectsV2
[2023-08-22T02:47:47Z INFO tracing::span] try_op;
[2023-08-22T02:47:47Z DEBUG aws_smithy_runtime_api::client::interceptors::context] entering 'serialization' phase
[2023-08-22T02:47:47Z DEBUG tracing::span] serialization;
[2023-08-22T02:47:47Z DEBUG aws_smithy_runtime_api::client::interceptors::context] entering 'before transmit' phase
[2023-08-22T02:47:47Z DEBUG aws_smithy_runtime::client::retries::strategy::standard] no client rate limiter configured, so no token is required for the initial request.
[2023-08-22T02:47:47Z DEBUG aws_smithy_runtime::client::orchestrator] retry strategy has OKed initial request
[2023-08-22T02:47:47Z DEBUG aws_smithy_runtime::client::orchestrator] beginning attempt #1
[2023-08-22T02:47:47Z INFO tracing::span] try_attempt;
[2023-08-22T02:47:47Z DEBUG aws_smithy_runtime::client::orchestrator::endpoints] will use endpoint Endpoint { url: "https://remote-data-sync.s3.us-east-2.amazonaws.com", headers: {}, properties: {"authSchemes": Array([Object({"name": String("sigv4"), "signingName": String("s3"), "disableDoubleEncoding": Bool(true), "signingRegion": String("us-east-2")})])} }
[2023-08-22T02:47:47Z INFO tracing::span] lazy_load_credentials;
[2023-08-22T02:47:47Z INFO aws_credential_types::cache::lazy_caching] credentials cache miss occurred; added new AWS credentials (took Ok(17.101µs))
[2023-08-22T02:47:47Z DEBUG aws_credential_types::cache::lazy_caching] loaded credentials
[2023-08-22T02:47:47Z DEBUG aws_smithy_runtime_api::client::interceptors::context] entering 'transmit' phase
[2023-08-22T02:47:47Z DEBUG hyper::client::connect::dns] resolving host="remote-data-sync.s3.us-east-2.amazonaws.com"
[2023-08-22T02:47:50Z DEBUG aws_smithy_runtime::client::orchestrator] encountered orchestrator error; halting
[2023-08-22T02:47:50Z INFO tracing::span] finally_attempt;
[2023-08-22T02:47:50Z DEBUG aws_smithy_runtime::client::retries::strategy::standard] attempt #1 failed with Error(TransientError); retrying after 75.611861ms
[2023-08-22T02:47:50Z DEBUG aws_smithy_runtime::client::orchestrator] delaying for 75.611861ms
[2023-08-22T02:47:50Z DEBUG aws_smithy_runtime::client::orchestrator] beginning attempt #2
[2023-08-22T02:47:50Z INFO tracing::span] try_attempt;
[2023-08-22T02:47:50Z DEBUG aws_smithy_runtime::client::orchestrator::endpoints] will use endpoint Endpoint { url: "https://remote-data-sync.s3.us-east-2.amazonaws.com", headers: {}, properties: {"authSchemes": Array([Object({"disableDoubleEncoding": Bool(true), "signingName": String("s3"), "name": String("sigv4"), "signingRegion": String("us-east-2")})])} }
[2023-08-22T02:47:50Z DEBUG aws_credential_types::cache::lazy_caching] loaded credentials from cache
[2023-08-22T02:47:50Z DEBUG aws_smithy_runtime_api::client::interceptors::context] entering 'transmit' phase
[2023-08-22T02:47:50Z DEBUG hyper::client::connect::dns] resolving host="remote-data-sync.s3.us-east-2.amazonaws.com"
[2023-08-22T02:47:53Z DEBUG aws_smithy_runtime::client::orchestrator] encountered orchestrator error; halting
[2023-08-22T02:47:53Z INFO tracing::span] finally_attempt;
[2023-08-22T02:47:53Z DEBUG aws_smithy_runtime::client::retries::strategy::standard] attempt #2 failed with Error(TransientError); retrying after 1.944612874s
[2023-08-22T02:47:53Z DEBUG aws_smithy_runtime::client::orchestrator] delaying for 1.944612874s
[2023-08-22T02:47:55Z DEBUG aws_smithy_runtime::client::orchestrator] beginning attempt #3
[2023-08-22T02:47:55Z INFO tracing::span] try_attempt;
[2023-08-22T02:47:55Z DEBUG aws_smithy_runtime::client::orchestrator::endpoints] will use endpoint Endpoint { url: "https://remote-data-sync.s3.us-east-2.amazonaws.com", headers: {}, properties: {"authSchemes": Array([Object({"signingName": String("s3"), "disableDoubleEncoding": Bool(true), "name": String("sigv4"), "signingRegion": String("us-east-2")})])} }
[2023-08-22T02:47:55Z DEBUG aws_credential_types::cache::lazy_caching] loaded credentials from cache
[2023-08-22T02:47:55Z DEBUG aws_smithy_runtime_api::client::interceptors::context] entering 'transmit' phase
[2023-08-22T02:47:55Z DEBUG hyper::client::connect::dns] resolving host="remote-data-sync.s3.us-east-2.amazonaws.com"
[2023-08-22T02:47:58Z DEBUG aws_smithy_runtime::client::orchestrator] encountered orchestrator error; halting
[2023-08-22T02:47:58Z INFO tracing::span] finally_attempt;
[2023-08-22T02:47:58Z DEBUG aws_smithy_runtime::client::retries::strategy::standard] not retrying because we are out of attempts attempts=3 max_attempts=3
[2023-08-22T02:47:58Z DEBUG aws_smithy_runtime::client::orchestrator] a retry is either unnecessary or not possible, exiting attempt loop
[2023-08-22T02:47:58Z INFO tracing::span] finally_op;
This looks relevant:
[2023-08-22T02:47:42Z DEBUG reqwest::connect] starting new connection: https://api.ipify.org/
[2023-08-22T02:47:42Z DEBUG hyper::client::connect::dns] resolving host="api.ipify.org"
What is this endpoint, and why is reqwest using it instead of the remote-data-sync.s3.us-east-2.amazonaws.com
endpoint?
Not really, that is another request I am making as part of the application. Forgot to remove it when pasting the logs.
On Wed, Aug 23, 2023 at 12:37 PM, John DiSanti @.***(mailto:On Wed, Aug 23, 2023 at 12:37 PM, John DiSanti < wrote:
This looks relevant:
[2023-08-22T02:47:42Z DEBUG reqwest::connect] starting new connection: https://api.ipify.org/ [2023-08-22T02:47:42Z DEBUG hyper::client::connect::dns] resolving host="api.ipify.org"
What is this endpoint, and why is reqwest using it instead of the remote-data-sync.s3.us-east-2.amazonaws.com endpoint?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
I'm at a loss here. I don't know why it's not working for you, and I'm not able to reproduce it. Does it work against the previous release (aws-sdk-s3 0.28
and aws-config 0.55
)?
I tried the older version, still the same issue. Is there a way to increase the timeout? For the successful request, it looks like it takes 5 seconds to resolve the host, but the s3 client times out after 3 seconds. Could this the issue?
I just had to increase the timeout :'). It works now...
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
I'm glad you figured it out! 5 seconds seems like a really long time...
Describe the bug
When trying to create an S3 client using config and listing the objects in bucket, the request takes a long time and ends up timing out.
Expected Behavior
Create the client, call the function, get the output. Not return an error
Current Behavior
Fails with this log:
And returns this error value:
Reproduction Steps
Create the config and the S3 client
Call the
list_objects_v2()
function:Get the error.
Possible Solution
No response
Additional Information/Context
No response
Version
Environment details (OS name and version, etc.)
Linux 6.4.9-arch1-1 x86_64 GNU/Linux
Logs