Open
Description
Checkboxes for prior research
- I've gone through Developer Guide and API reference
- I've checked AWS Forums and StackOverflow.
- I've searched for previous similar issues and didn't find any solution.
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:
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