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

PutObjectWithContext SerializationError: failed to determine start of request body #5107

Closed
abing258 opened this issue Dec 13, 2023 · 2 comments
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@abing258
Copy link

abing258 commented Dec 13, 2023

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

@abing258 abing258 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 13, 2023
@abing258
Copy link
Author

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

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. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant