-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
problem with s3 delete_objects #597
Comments
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:
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 ropensci/targets#1171) and it would be great to get |
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 Session infosessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.3.2 (2023-10-31)
#> os macOS Sonoma 14.0
#> system aarch64, darwin20
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz Europe/London
#> date 2023-11-08
#> pandoc 3.1.9 @ /opt/homebrew/bin/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> base64enc 0.1-3 2015-07-28 [1] CRAN (R 4.3.0)
#> cli 3.6.1 2023-03-23 [1] CRAN (R 4.3.0)
#> crayon 1.5.2 2022-09-29 [1] CRAN (R 4.3.0)
#> curl 5.1.0 2023-10-02 [1] CRAN (R 4.3.1)
#> digest 0.6.33 2023-07-07 [1] CRAN (R 4.3.0)
#> evaluate 0.23 2023-11-01 [1] CRAN (R 4.3.1)
#> fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.3.0)
#> fs 1.6.3 2023-07-20 [1] CRAN (R 4.3.0)
#> glue 1.6.2 2022-02-24 [1] CRAN (R 4.3.0)
#> htmltools 0.5.7 2023-11-03 [1] CRAN (R 4.3.1)
#> httr 1.4.7 2023-08-15 [1] CRAN (R 4.3.0)
#> knitr 1.45 2023-10-30 [1] CRAN (R 4.3.1)
#> lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.3.0)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.3.0)
#> mime 0.12 2021-09-28 [1] CRAN (R 4.3.0)
#> paws.common 0.6.3.9000 2023-11-08 [1] Github (dyfanjones/paws@a7aaf4d)
#> paws.storage 0.5.0 2023-11-02 [1] local (/Users/dyfanjones/Documents/Packages/paws/cran/paws.storage)
#> purrr 1.0.2 2023-08-10 [1] CRAN (R 4.3.0)
#> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.3.0)
#> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.3.0)
#> R.oo 1.25.0 2022-06-12 [1] CRAN (R 4.3.0)
#> R.utils 2.12.2 2022-11-11 [1] CRAN (R 4.3.0)
#> R6 2.5.1 2021-08-19 [1] CRAN (R 4.3.0)
#> Rcpp 1.0.11 2023-07-06 [1] CRAN (R 4.3.0)
#> reprex 2.0.2 2022-08-17 [1] CRAN (R 4.3.0)
#> rlang 1.1.1 2023-04-28 [1] CRAN (R 4.3.0)
#> rmarkdown 2.25 2023-09-18 [1] CRAN (R 4.3.1)
#> rstudioapi 0.15.0 2023-07-07 [1] CRAN (R 4.3.0)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.0)
#> styler 1.10.2 2023-08-29 [1] CRAN (R 4.3.0)
#> vctrs 0.6.4 2023-10-12 [1] CRAN (R 4.3.1)
#> withr 2.5.2 2023-10-30 [1] CRAN (R 4.3.1)
#> xfun 0.41 2023-11-01 [1] CRAN (R 4.3.1)
#> xml2 1.3.5 2023-07-06 [1] CRAN (R 4.3.0)
#> yaml 2.3.7 2023-01-23 [1] CRAN (R 4.3.0)
#>
#> [1] /Users/dyfanjones/Library/R/arm64/4.3/library
#> [2] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
#>
#> ────────────────────────────────────────────────────────────────────────────── |
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):
The text was updated successfully, but these errors were encountered: