I am using R2 to upload images, But uploaded images not available in bucket
Subject: Image Upload to Cloudflare R2 Shows Successful but Files Not Appearing in Bucket
Hello,
I have configured my Cloudflare Worker to upload images to an R2 bucket. The upload process completes successfully, and the response indicates that the files have been uploaded. However, when I check the R2 bucket, the images are not visible.
Here are the key details of my issue:
The response from the Worker after the upload is successful, but the files are not appearing in the R2 dashboard.
The Worker is using the put() method with the image file and correct content type (e.g., 'image/png').
I have verified that the bucket permissions are set correctly for the Worker.
There are no apparent errors in the Worker logs.
Could you please assist me in troubleshooting why the uploaded files are not appearing in the R2 bucket, despite the successful response?
Code
const response = await env.MY_BUCKET.put(uniqueFileName, file.stream(), {
httpMetadata: {
"Content-Type": "multipart/form-data",
},
});
1 Reply
I am assuming that you are running this locally right now? On local environment, the Workers API will upload the file to local R2. Hence, you won't see it on the dashboard. If you try uploading from the deployed, your app will be available in the R2 bucket