PutObjectWithContext SerializationError: failed to determine start of request body
abing258 opened this issue · comments
Describe the bug
PutObjectWithContext is error :SerializationError: failed to determine start of request body
Expected Behavior
succeed
Current Behavior
SerializationError: failed to determine start of request body\ncaused by: operation not supported
Reproduction Steps
config := &aws.Config{
Region: aws.String(os.Getenv("S3_REGION")),
Endpoint: aws.String(os.Getenv("S3_ENDPOINT")),
Credentials: credentials.NewStaticCredentials("user", "password", ""),
S3ForcePathStyle: aws.Bool(true), //virtual-host style方式,不要修改
}
session, err := session.NewSession(config)
if err != nil {
return nil, err
}
s3Client := s3.New(session)
if err != nil {
return nil, err
}
putObject, err := s3Client.PutObjectWithContext(context.Background(), &s3.PutObjectInput{
Body: file,
Bucket: aws.String(bucketName),
Key: aws.String(key),
})
Possible Solution
No response
Additional Information/Context
No response
SDK version used
v1.49.1
Environment details (Version of Go (go version
)? OS name and version, etc.)
go 1.20
putObject, err := s3Client.PutObjectWithContext(context.Background(), &s3.PutObjectInput{
Body: bytes.NewReader(fileByte),
Bucket: aws.String(bucketName),
Key: aws.String(key),
}) is successful
Sorry. Previously, the body type used file, so there was an issue. This is a big black dragon
⚠️ 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.