Code that worked in 1.2.4 is now broken in the 2.2.0 version #582
-
Hello, I don't open an issue because I'm not pretty sure if it's something I'm doing wrong, but after migrating from 1.2.4 to 2.2.0 I'm getting an error, on a code that worked before the migration My code is just invoking the following Files.newByteChannel(path, StandardOpenOption.READ); and path is like s3://some-bucket/some-dir/some-file The reason to migrate was that the logback.xml present in the 1.2.4 was breaking my logging config |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Looks like the problem is occurring here https://github.com/awslabs/aws-java-nio-spi-for-s3/blob/main/src/main/java/software/amazon/nio/spi/s3/S3BasicFileAttributes.java#L235-L246 Not sure why that is the case. All it is doing is a HeadObject request? I will do some digging. In the meantime, can you try this? This example works for me and is pretty closely related to what you are doing. public class ReadAllBytes {
public static void main(String[] args) throws IOException {
var filePath = Paths.get(URI.create(args[0]));
final var bytes = Files.readAllBytes(filePath);
// assumes this is a text file
final var data = new String(bytes, StandardCharsets.UTF_8);
System.out.println(data);
}
} |
Beta Was this translation helpful? Give feedback.
Ok, after further debugging I found the offending code, I have no idea on in what git repo this class is
S3CrtAsyncHttpClient
in 2.20.116 version of awssdk.s3 , the reason it worked 1.2.4 is because it used the v1 s3 sdk.After updating the client to 2.29.35 it works
This is the failing code, I'm unable to find the github repo, so no idea in which awssdk version it got fixed, but anyway, it works now!
Note that requestOptions is missing the operationName