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?
response":{"storageClass":"","customMetadata":{},"httpMetadata":{},"uploaded":"2024-10-24T11:38:08.013Z","checksums":{"md5":"86cc1e9865dba3eaf86acc134f4ce126"},"httpEtag":"\"86cc1e9865dba3eaf86acc134f4ce126\"","etag":"86cc1e9865dba3eaf86acc134f4ce126","size":52733,"version":"fda1b9d832f442bf6f7de8f83a2ebba1","key":"client_03345jsfidfh7w68cde3wc_Screenshot_2024-10-24_at_5png"}
response":{"storageClass":"","customMetadata":{},"httpMetadata":{},"uploaded":"2024-10-24T11:38:08.013Z","checksums":{"md5":"86cc1e9865dba3eaf86acc134f4ce126"},"httpEtag":"\"86cc1e9865dba3eaf86acc134f4ce126\"","etag":"86cc1e9865dba3eaf86acc134f4ce126","size":52733,"version":"fda1b9d832f442bf6f7de8f83a2ebba1","key":"client_03345jsfidfh7w68cde3wc_Screenshot_2024-10-24_at_5png"}
Code const response = await env.MY_BUCKET.put(uniqueFileName, file.stream(), { httpMetadata: { "Content-Type": "multipart/form-data", }, });
1 Reply
harshil1712
harshil17124w ago
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
Want results from more Discord servers?
Add your server