I uploaded a file to S3 with some metadata like x-amz-meta-description="some description". When I check the metadata using the Amazon console, it's there. To access the headers, I added the following CORS configuration:
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>HEAD</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
Now, from my web app, I'm attempting to check the headers of my file using the following javascript code:
AWS.config.update({accessKeyId: 'XXX', secretAccessKey: 'YYY'})
var bucket = new AWS.S3({params: {Bucket: 'zzz'}});
var params = {Bucket: 'zzz',Key: 'content/myfile.doc'};
bucket.headObject(params, function (err, data) {
if (err)
console.log(err, err.stack);
else
console.log(data);
});
However, after running the code, the data.Metadata is empty. Is there any other configuration required to retrieve the metadata associated with the file? What am I missing?
Appreciate all the help!
PS: I also tried using the getObject function, but the Metadata remains empty.