Closed lorenzo-desantis-imagicle closed 3 years ago
Hey @lorenzo-desantis-imagicle can you give a code example of how you are both uploading and downloading the file, and in addition can you provide details on how you know the files are different are you performing a byte per byte comparison or using a hash like sha256?
Additionally, are you uploading the object to the bucket using the Go SDK (S3 Client or S3 Transfer Manager), or are you using another SDK or CLI?
I am not able to replicate the issue you are seeing, and have attempted to reproduce the described issue in the following ways:
go.mod
module temp
go 1.17
require (
github.com/aws/aws-sdk-go-v2 v1.9.0
github.com/aws/aws-sdk-go-v2/config v1.8.0
github.com/aws/aws-sdk-go-v2/service/s3 v1.15.0
)
require (
github.com/aws/aws-sdk-go-v2/credentials v1.4.0 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.5.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.2.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.3.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.3.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.7.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.4.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.7.0 // indirect
github.com/aws/smithy-go v1.8.0 // indirect
)
I used byte-per-byte comparison, after uploading the file with a PUT to a pre-signed URL and downloading the file using GO SDK. (Downloading the file from S3 console after the PUT results in an identical byte-per-byte file, when compared to original file)
go.mod
go 1.15
require (
github.com/aws/aws-lambda-go v1.23.0
github.com/aws/aws-sdk-go-v2 v1.7.1
github.com/aws/aws-sdk-go-v2/config v1.2.0
github.com/aws/aws-sdk-go-v2/internal/ini v1.0.0 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.11.1
)
code
objectInput := s3.GetObjectInput{
Bucket: aws.String(bucketName),
Key: aws.String(key),
}
s3Obj, _ := client.GetObject(s.Context, &objectInput)
bytesRead, _ := io.ReadAll(s3Obj.Body)
(error management has been omitted here, errors were nil)
I am still not able to reproduce this behavior, and have attempted to reproduce this issue using the go.mod
version contents you have provided. Can you share with my the exact file bytes size of the file that you are encountering this issue with? Additionally what environments are you seeing this behavior on Windows, Linux, macOS, AWS Lambda environment etc. Additionally are you using a standard bucket, or are you accessing it via an S3 AccessPoint or VPC endpoint etc.
Confirm by changing [ ] to [x] below to ensure that it's a bug:
Describe the bug When reading bytes from the io.ReadCloser returned as Body field in a GetObjectOutput from a GetObject call, they differ from the file actually stored on S3. Performing the same call for the same file on different clients (AWS CLI, boto3) returns the correct file, instead. In particular, 27 heading bytes are missing with respect to the original file.
Version of AWS SDK for Go? v1.11.1
Version of Go (
go version
)? 1.15To Reproduce (observed behavior)
Expected behavior Bytes are expected to be the same.
Additional context The given file is a MP3 file with tags encoded with ID3v2.3 tags version.