Skip to content

Cache-Control set to no-cache even though not specified in Upload params #7053

Open
@giilby

Description

@giilby

Checkboxes for prior research

Describe the bug

I'm trying to use Upload from @aws-sdk/lib-storage to upload images to an S3 bucket. Formerly, I used PutObjectCommand and didn't have this issue. Anyway, my parameters are very simple:

const upload = new Upload({
    client: s3Client,
    params: {
      Bucket: bucket,
      Key: key,
      Body: file,
      ContentType: file.type
    },
  })

Unexpectedly, when I look at the uploaded object in S3, the Cache-Control metadata is set to no-cache, even though I didn't specify that in the params. Any idea what's going on?

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/client-s3 v3.802.0, @aws-sdk/lib-storage v3.802.0

Which JavaScript Runtime is this issue in?

Browser

Details of the browser/Node.js/ReactNative version

Chrome: 135.0.7049.116

Reproduction Steps

const s3Client = new S3Client({
  region: 'us-east-1',
  credentials: [your credentials here]
})

// get a reference to a JPEG or PNG File object

const upload = new Upload({
  client: s3Client,
  params: {
    Bucket: 'some-bucket-name',
    Key: 'some-key-path',
    Body: file,
    ContentType: file.type
  },
})

await upload.done()

Observed Behavior

The Cache-Control metadata item is inexplicably set:

Image

Expected Behavior

The Cache-Control metadata is not present on the object.

Possible Solution

Currently, our workaround is to include CacheControl: 'public' in our Upload params.

Additional Information/Context

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p2This is a standard priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions