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

aws_smithy_http::byte_stream::ByteStream Deprecated, no other way to import it #936

Closed
xanderdunn opened this issue Nov 1, 2023 · 5 comments
Labels
bug This issue is a bug. response-requested Waiting on additional info and feedback. Will move to 'closing-soon' in 7 days.

Comments

@xanderdunn
Copy link

Describe the bug

With the latest release of aws-smithy-http, aws_smithy_http::byte_stream::ByteStream has been deprecated in favor of aws_smithy_types::byte_stream::ByteStream. However, we cannot directly reference the aws_smithy_types crate, as described on the crate itself, here. So, we are no longer able to compile our code.

Expected Behavior

There should be some way for a user of the libraries to use ByteStream while on latest versions of the aws-sdk-* libraries.

Current Behavior

Compiler errors:

error: use of deprecated type alias `aws_smithy_http::byte_stream::ByteStream`: Moved to `aws_smithy_types::byte_stream::ByteStream`.
 --> s3/src/multipart.rs:9:35
  |
9 | use aws_smithy_http::byte_stream::ByteStream;
  |                                   ^^^^^^^^^^
  |
  = note: `-D deprecated` implied by `-D warnings`

error: use of deprecated type alias `aws_smithy_http::byte_stream::ByteStream`: Moved to `aws_smithy_types::byte_stream::ByteStream`.
  --> s3/src/multipart.rs:59:19
   |
59 |             .body(ByteStream::from(
   |                   ^^^^^^^^^^

error[E0308]: mismatched types
   --> s3/src/multipart.rs:59:19
    |
59  |               .body(ByteStream::from(
    |  ______________----_^
    | |              |
    | |              arguments to this method are incorrect
60  | |                 content[chunk_index * CHUNK_SIZE..chunk_index * CHUNK_SIZE + this_chunk].to_vec(),
61  | |             ))
    | |_____________^ expected `aws_sdk_s3::primitives::ByteStream`, found `aws_smithy_types::byte_stream::ByteStream`
    |
    = note: `aws_smithy_types::byte_stream::ByteStream` and `aws_sdk_s3::primitives::ByteStream` have similar names, but are actually distinct types
note: `aws_smithy_types::byte_stream::ByteStream` is defined in crate `aws_smithy_types`

Reproduction Steps

Try to compile this code:

use aws_smithy_http::byte_stream::ByteStream;

    let multipart_upload_res: CreateMultipartUploadOutput = client
        .create_multipart_upload()
        .bucket(bucket)
        .key(file_name)
        .send()
        .await?;
    let upload_id = multipart_upload_res.upload_id().unwrap();

    let file_size = content.len();

    if file_size == 0 {
        panic!("Bad file size.");
    }

    let chunk_count = (file_size + CHUNK_SIZE - 1) / CHUNK_SIZE;
    let size_of_last_chunk = (file_size - 1) % CHUNK_SIZE + 1;

    if chunk_count > MAX_CHUNKS {
        panic!("Too many chunks! Try increasing your chunk size.")
    }

    let mut upload_parts: Vec<CompletedPart> = Vec::new();

    for chunk_index in 0..chunk_count {
        let this_chunk = if chunk_count - 1 == chunk_index {
            size_of_last_chunk
        } else {
            CHUNK_SIZE
        };
        let part_number = (chunk_index as i32) + 1;
        let upload_part_res = client
            .upload_part()
            .key(file_name)
            .bucket(bucket)
            .upload_id(upload_id)
            .body(ByteStream::from(
                content[chunk_index * CHUNK_SIZE..chunk_index * CHUNK_SIZE + this_chunk].to_vec(),
            ))
            .part_number(part_number)
            .send()
            .await?;
        upload_parts.push(
            CompletedPart::builder()
                .e_tag(upload_part_res.e_tag.unwrap_or_default())
                .part_number(part_number)
                .build(),
        );
    }

Possible Solution

We are holding back aws-smithy-http to 0.56 for now and that allows our code to compile.

Additional Information/Context

No response

Version

$ cargo tree | grep aws-
│   │   ├── aws-config v0.56.1
│   │   │   ├── aws-credential-types v0.56.1
│   │   │   │   ├── aws-smithy-async v0.56.1
│   │   │   │   ├── aws-smithy-types v0.56.1
│   │   │   ├── aws-http v0.56.1
│   │   │   │   ├── aws-credential-types v0.56.1 (*)
│   │   │   │   ├── aws-smithy-http v0.56.1
│   │   │   │   │   ├── aws-smithy-eventstream v0.56.1
│   │   │   │   │   │   ├── aws-smithy-types v0.56.1 (*)
│   │   │   │   │   ├── aws-smithy-types v0.56.1 (*)
│   │   │   │   ├── aws-smithy-types v0.56.1 (*)
│   │   │   │   ├── aws-types v0.56.1
│   │   │   │   │   ├── aws-credential-types v0.56.1 (*)
│   │   │   │   │   ├── aws-smithy-async v0.56.1 (*)
│   │   │   │   │   ├── aws-smithy-client v0.56.1
│   │   │   │   │   │   ├── aws-smithy-async v0.56.1 (*)
│   │   │   │   │   │   ├── aws-smithy-http v0.56.1 (*)
│   │   │   │   │   │   ├── aws-smithy-http-tower v0.56.1
│   │   │   │   │   │   │   ├── aws-smithy-http v0.56.1 (*)
│   │   │   │   │   │   │   ├── aws-smithy-types v0.56.1 (*)
│   │   │   │   │   │   ├── aws-smithy-types v0.56.1 (*)
│   │   │   │   │   ├── aws-smithy-http v0.56.1 (*)
│   │   │   │   │   ├── aws-smithy-types v0.56.1 (*)
│   │   │   ├── aws-sdk-sso v0.30.0
│   │   │   │   ├── aws-credential-types v0.56.1 (*)
│   │   │   │   ├── aws-http v0.56.1 (*)
│   │   │   │   ├── aws-runtime v0.56.1
│   │   │   │   │   ├── aws-credential-types v0.56.1 (*)
│   │   │   │   │   ├── aws-http v0.56.1 (*)
│   │   │   │   │   ├── aws-sigv4 v0.56.1
│   │   │   │   │   │   ├── aws-smithy-eventstream v0.56.1 (*)
│   │   │   │   │   │   ├── aws-smithy-http v0.56.1 (*)
│   │   │   │   │   ├── aws-smithy-async v0.56.1 (*)
│   │   │   │   │   ├── aws-smithy-eventstream v0.56.1 (*)
│   │   │   │   │   ├── aws-smithy-http v0.56.1 (*)
│   │   │   │   │   ├── aws-smithy-runtime-api v0.56.1
│   │   │   │   │   │   ├── aws-smithy-async v0.56.1 (*)
│   │   │   │   │   │   ├── aws-smithy-http v0.56.1 (*)
│   │   │   │   │   │   ├── aws-smithy-types v0.56.1 (*)
│   │   │   │   │   ├── aws-smithy-types v0.56.1 (*)
│   │   │   │   │   ├── aws-types v0.56.1 (*)
│   │   │   │   ├── aws-smithy-async v0.56.1 (*)
│   │   │   │   ├── aws-smithy-client v0.56.1 (*)
│   │   │   │   ├── aws-smithy-http v0.56.1 (*)
│   │   │   │   ├── aws-smithy-json v0.56.1
│   │   │   │   │   └── aws-smithy-types v0.56.1 (*)
│   │   │   │   ├── aws-smithy-runtime v0.56.1
│   │   │   │   │   ├── aws-smithy-async v0.56.1 (*)
│   │   │   │   │   ├── aws-smithy-client v0.56.1 (*)
│   │   │   │   │   ├── aws-smithy-http v0.56.1 (*)
│   │   │   │   │   ├── aws-smithy-runtime-api v0.56.1 (*)
│   │   │   │   │   ├── aws-smithy-types v0.56.1 (*)
│   │   │   │   ├── aws-smithy-runtime-api v0.56.1 (*)
│   │   │   │   ├── aws-smithy-types v0.56.1 (*)
│   │   │   │   ├── aws-types v0.56.1 (*)
│   │   │   ├── aws-sdk-sts v0.30.0
│   │   │   │   ├── aws-credential-types v0.56.1 (*)
│   │   │   │   ├── aws-http v0.56.1 (*)
│   │   │   │   ├── aws-runtime v0.56.1 (*)
│   │   │   │   ├── aws-smithy-async v0.56.1 (*)
│   │   │   │   ├── aws-smithy-client v0.56.1 (*)
│   │   │   │   ├── aws-smithy-http v0.56.1 (*)
│   │   │   │   ├── aws-smithy-json v0.56.1 (*)
│   │   │   │   ├── aws-smithy-query v0.56.1
│   │   │   │   │   ├── aws-smithy-types v0.56.1 (*)
│   │   │   │   ├── aws-smithy-runtime v0.56.1 (*)
│   │   │   │   ├── aws-smithy-runtime-api v0.56.1 (*)
│   │   │   │   ├── aws-smithy-types v0.56.1 (*)
│   │   │   │   ├── aws-smithy-xml v0.56.1
│   │   │   │   ├── aws-types v0.56.1 (*)
│   │   │   ├── aws-smithy-async v0.56.1 (*)
│   │   │   ├── aws-smithy-client v0.56.1 (*)
│   │   │   ├── aws-smithy-http v0.56.1 (*)
│   │   │   ├── aws-smithy-http-tower v0.56.1 (*)
│   │   │   ├── aws-smithy-json v0.56.1 (*)
│   │   │   ├── aws-smithy-types v0.56.1 (*)
│   │   │   ├── aws-types v0.56.1 (*)
│   │   ├── aws-sdk-s3 v0.34.0
│   │   │   ├── aws-credential-types v0.56.1 (*)
│   │   │   ├── aws-http v0.56.1 (*)
│   │   │   ├── aws-runtime v0.56.1 (*)
│   │   │   ├── aws-sigv4 v0.56.1 (*)
│   │   │   ├── aws-smithy-async v0.56.1 (*)
│   │   │   ├── aws-smithy-checksums v0.56.1
│   │   │   │   ├── aws-smithy-http v0.56.1 (*)
│   │   │   │   ├── aws-smithy-types v0.56.1 (*)
│   │   │   ├── aws-smithy-client v0.56.1 (*)
│   │   │   ├── aws-smithy-eventstream v0.56.1 (*)
│   │   │   ├── aws-smithy-http v0.56.1 (*)
│   │   │   ├── aws-smithy-json v0.56.1 (*)
│   │   │   ├── aws-smithy-runtime v0.56.1 (*)
│   │   │   ├── aws-smithy-runtime-api v0.56.1 (*)
│   │   │   ├── aws-smithy-types v0.56.1 (*)
│   │   │   ├── aws-smithy-xml v0.56.1 (*)
│   │   │   ├── aws-types v0.56.1 (*)
│   │   ├── aws-smithy-http v0.57.0
│   │   │   ├── aws-smithy-runtime-api v0.57.0
│   │   │   │   ├── aws-smithy-async v0.57.0
│   │   │   │   ├── aws-smithy-types v0.57.0
│   │   │   ├── aws-smithy-types v0.57.0 (*)


### Environment details (OS name and version, etc.)

Ubuntu 20.04

### Logs

_No response_
@xanderdunn xanderdunn added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 1, 2023
@xanderdunn xanderdunn changed the title (short issue description) aws_smithy_http::byte_stream::ByteStream Deprecated, no other way to import it Nov 1, 2023
@jdisanti
Copy link
Contributor

jdisanti commented Nov 1, 2023

ByteStream is re-exported in the SDK crates that use it. For example, it's in the primitives module for S3: https://docs.rs/aws-sdk-s3/latest/aws_sdk_s3/primitives/struct.ByteStream.html

@rcoh
Copy link
Contributor

rcoh commented Nov 1, 2023

Also, we're currently in the process of releasing the new version of the SDK that depends on 0.57–for now, stick with 0.56 until the new SDK is out.

@Velfi Velfi removed the needs-triage This issue or PR still needs to be triaged. label Nov 2, 2023
@rcoh
Copy link
Contributor

rcoh commented Nov 6, 2023

The new release is out—please let us know if you hit any issues. You can use re-exported ByteStream: https://docs.rs/aws-sdk-s3/latest/aws_sdk_s3/primitives/struct.ByteStream.html

@rcoh rcoh added the response-requested Waiting on additional info and feedback. Will move to 'closing-soon' in 7 days. label Nov 6, 2023
@xanderdunn
Copy link
Author

Yes, this is fixed now, thank you!

Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. response-requested Waiting on additional info and feedback. Will move to 'closing-soon' in 7 days.
Projects
None yet
Development

No branches or pull requests

4 participants