r2 metadata not working

R2 metadata causes cors error. client
const response = await fetch(signedUrl, {
method: "PUT",
headers: {
"x-amz-meta-name": "name",
"Content-Length": String(fileSize),
"Content-Type": fileType,
},
body: file,
});
const response = await fetch(signedUrl, {
method: "PUT",
headers: {
"x-amz-meta-name": "name",
"Content-Length": String(fileSize),
"Content-Type": fileType,
},
body: file,
});
server
const cmd = new PutObjectCommand({
Bucket,
Key,
ContentLength: fileSize,
ContentType: fileType,
});

const signedUrl = await getSignedUrl(r2Client, cmd);
const cmd = new PutObjectCommand({
Bucket,
Key,
ContentLength: fileSize,
ContentType: fileType,
});

const signedUrl = await getSignedUrl(r2Client, cmd);
CORS policy
[
{
"AllowedOrigins": [
"*"
],
"AllowedMethods": [
"GET",
"PUT",
"POST",
"DELETE"
],
"AllowedHeaders": [
"*"
],
"ExposeHeaders": [],
"MaxAgeSeconds": 3000
}
]
[
{
"AllowedOrigins": [
"*"
],
"AllowedMethods": [
"GET",
"PUT",
"POST",
"DELETE"
],
"AllowedHeaders": [
"*"
],
"ExposeHeaders": [],
"MaxAgeSeconds": 3000
}
]
1 Reply
Vero
Vero2w ago
Hey. Can you please move this question to the channel #r2?