Closed dleopold closed 12 months ago
Hi @dleopold sorry about that. Have you tried to delete objects without Quiet parameter?
svc$delete_objects(
Bucket = "...",
Delete = list(
Objects = list(
list(
Key = "..."
),
list(
Key = "..."
)
)
)
)
Here is an example of it working in the up and coming s3fs package https://github.com/DyfanJones/s3fs/blob/main/R/s3filesystem_class.R#L349-L362 .
Interesting I didn't realise this:
Also, FYI, I noticed that attempting to use either delete_object or delete_objects when the bucket is in a different region, the operation fails with an unhelpful error message:
Error in enc2utf8(data) : argument is not a character vector
I will have to have a look why this is the case 🤔
It does seem to work with the Quiet parameter removed. Not sure how I failed to try that. Thank you. I will close the issue since it is resolved for me, though maybe a quick update to the docs would prevent others from running into the same issue. Also, s3fs looks promising!
I am hitting this issue too (working on https://github.com/ropensci/targets/issues/1171) and it would be great to get Quiet = TRUE
to work. Quiet mode sends a smaller HTTP response, so it could perform faster.
Happy to re-open this ticket.
Ok I think I have fixed it:
remotes::install_github("dyfanjones/paws/paws.common", ref = "xml_build_flatten")
client <- paws.storage::s3()
bucket <- "mybucket"
key <- "removable.txt"
resp <- client$put_object(
Bucket = bucket,
Key = key,
Body = charToRaw("dummy")
)
client$delete_objects(
Bucket = bucket,
Delete = list(
Objects = list(
list(Key = key)
),
Quiet = T
)
)
#> $Deleted
#> list()
#>
#> $RequestCharged
#> character(0)
#>
#> $Errors
#> list()
Created on 2023-11-08 with reprex v2.0.2
@wlandau @dleopold Please try it out and let me know :)
Thanks so much, @DyfanJones! Works for me now!
Works here. Thanks.
paws.common 0.6.4 has been released to cran.
I am unable to use delete_objects to batch delete objects from an s3 bucket. Copying the documentation exactly
returns an error:
Error: MalformedXML (HTTP 400). The XML you provided was not well-formed or did not validate against our published schema
I have the correct permissions and can delete objects individually using delete_object.
Also, FYI, I noticed that attempting to use either delete_object or delete_objects when the bucket is in a different region, the operation fails with an unhelpful error message:
Error in enc2utf8(data) : argument is not a character vector
It took me a while to figure that one out.
Here is my current session info (though I have also tried with the dev version of paws):