Skip to content

"SignatureDoesNotMatch" Error When Using PresignPutObject with Expires #2523

Closed
@xuanyu66

Description

Describe the bug

When generating a presigned URL with PresignPutObject and setting the Expires field, attempting to put an object to S3 returns the error "SignatureDoesNotMatch". However, without setting the Expires field, it works fine.

Expected Behavior

return 200

Current Behavior

<Error>
  <Code>SignatureDoesNotMatch</Code>
  <Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>

Reproduction Steps

// not working
request, err := s.s3Presign.PresignPutObject(ctx, &s3.PutObjectInput{
			Bucket:  &bucket,
			Key:     &key,
			Expires: &expire,
		}, s3.WithPresignExpires(6*time.Hour))
		if err != nil {
			return nil, err
		}


// works fine
		request, err := s.s3Presign.PresignPutObject(ctx, &s3.PutObjectInput{
			Bucket:  &bucket,
			Key:     &key,
		}, s3.WithPresignExpires(6*time.Hour))
		if err != nil {
			return nil, err
		}

Possible Solution

No response

Additional Information/Context

No response

AWS Go SDK V2 Module Versions Used

Compiler and Version used

go version go1.21.3 darwin/arm64

Operating System and version

macOS Ventura 13.6.4

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions