Skip to content
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

S3 HEAD partial matches on expected error #869

Closed
wlandau opened this issue Jan 2, 2025 · 2 comments · Fixed by #871
Closed

S3 HEAD partial matches on expected error #869

wlandau opened this issue Jan 2, 2025 · 2 comments · Fixed by #871
Labels
bug 🐞 Something isn't working

Comments

@wlandau
Copy link

wlandau commented Jan 2, 2025

Under certain circumstances when used in targets, paws seems to use partial matches. Reprex using the CRAN releases:

library(paws.common)
library(paws.storage)
print(packageVersion("paws.common"))
#> [1] ‘0.7.7’
print(packageVersion("paws.storage"))
#> [1] ‘0.7.0’
client <- s3()
bucket <- "test-paws-common-partial-matches8"
response <- client$create_bucket(Bucket = bucket)
response <- client$put_object(
  Bucket = bucket,
  Key = "x",
  Body = charToRaw("abcde")
)
options(warnPartialMatchArgs = TRUE)
response <- client$head_object(
  Bucket = bucket,
  Key = "x",
  ExpectedBucketOwner = "phantom_f4acd87c52d4e62b"
)
#> Error: SerializationError (HTTP 400). An error occurred when calling the HeadObject operation: Bad Request
#> In addition: Warning messages:
#> 1: In url$host : partial match of 'host' to 'hostname'
#> 2: In url$host : partial match of 'host' to 'hostname'

The error is expected, but the warning are not. Traceback to the first occurrence of the warning:

11: doWithOneRestart(return(expr), restart)
10: withOneRestart(expr, restarts[[1L]])
9: withRestarts({
       .Internal(.signalCondition(simpleWarning(msg, call), msg,
           call))
       .Internal(.dfltWarn(msg, call))
   }, muffleWarning = function() NULL)
8: .signalSimpleWarning("partial match of 'host' to 'hostname'",
       base::quote(url$host))
7: build_url(final_endpoint_components)
6: set_request_url(request$client_info$endpoint, ep_info$endpoint)
5: handler$fn(request)
4: run(request, send)
3: send(request)
2: send_request(request)
1: client$head_object(Bucket = bucket, Key = "x", ExpectedBucketOwner = "phantom_f4acd87c52d4e62b")

I tried to test the development versions of paws.common and paws.storage as well, but the HEAD request is failing with "Error: SignatureDoesNotMatch (HTTP 403). The request signature we calculated does not match the signature you provided. Check your key and signing method" (c.f #868) when I would expect the call to succeed.

Session info:

R version 4.4.0 (2024-04-24)
Platform: aarch64-apple-darwin20
Running under: macOS 15.2

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/Indiana/Indianapolis
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base    

other attached packages:
[1] paws.storage_0.7.0 paws.common_0.7.7  targets_1.9.1.9003 testthat_3.2.1.1  

loaded via a namespace (and not attached):
 [1] tidyselect_1.2.1      dplyr_1.1.4           arrow_16.1.0          R.utils_2.12.3      
 [5] fastmap_1.2.0         promises_1.3.0        stringfish_0.16.0     digest_0.6.37        
 [9] base64url_1.4         mime_0.12             lifecycle_1.0.4       secretbase_1.0.3    
[13] waldo_0.5.2           ellipsis_0.3.2        processx_3.8.4        magrittr_2.0.3      
[17] compiler_4.4.0        rlang_1.1.4           tools_4.4.0           igraph_2.1.1        
[21] utf8_1.2.4            yaml_2.3.10           data.table_1.16.2     knitr_1.48          
[25] htmlwidgets_1.6.4     bit_4.5.0             pkgbuild_1.4.4        curl_6.0.1          
[29] xml2_1.3.6            pkgload_1.4.0         miniUI_0.1.1.1        withr_3.0.2          
[33] purrr_1.0.2           R.oo_1.26.0           desc_1.4.3            grid_4.4.0          
[37] fansi_1.0.6           urlchecker_1.0.1      profvis_0.3.8         colorspace_2.1-1    
[41] xtable_1.8-4          future_1.33.2         ggplot2_3.5.1         scales_1.3.0        
[45] globals_0.16.3        cli_3.6.3             crayon_1.5.3          generics_0.1.3      
[49] remotes_2.5.0         RcppParallel_5.1.9    rstudioapi_0.16.0     httr_1.4.7          
[53] sessioninfo_1.2.2     cachem_1.1.0          stringr_1.5.1         safetensors_0.1.2    
[57] assertthat_0.2.1      parallel_4.4.0        coro_1.0.4            base64enc_0.1-3      
[61] vctrs_0.6.5           devtools_2.4.5        jsonlite_1.8.9        callr_3.7.6          
[65] bit64_4.5.2           listenv_0.9.1         glue_1.8.0            parallelly_1.37.1    
[69] crew_0.10.2.9001      codetools_0.2-20      ps_1.8.1              gtable_0.3.5        
[73] stringi_1.8.4         later_1.3.2           munsell_0.5.1         getip_0.1-4          
[77] tibble_3.2.1          pillar_1.9.0          htmltools_0.5.8.1     brio_1.1.5          
[81] torch_0.13.0          R6_2.5.1              autometric_0.1.2.9001 rprojroot_2.0.4      
[85] shiny_1.8.1.1         R.methodsS3_1.8.2     backports_1.5.0       nanonext_1.3.2.9000  
[89] mirai_1.3.1.9000      memoise_2.0.1         httpuv_1.6.15         Rcpp_1.0.13-1        
[93] qs2_0.1.2             xfun_0.49             fs_1.6.4              usethis_2.2.3        
[97] pkgconfig_2.0.3  
@DyfanJones
Copy link
Member

Ah thanks for identify the issue. I will have a look at the #868 to see why it isn't signing correctly and make sure partial matches are remove

@DyfanJones DyfanJones added the bug 🐞 Something isn't working label Jan 2, 2025
DyfanJones added a commit to DyfanJones/paws that referenced this issue Jan 3, 2025
@DyfanJones DyfanJones reopened this Jan 3, 2025
@wlandau
Copy link
Author

wlandau commented Jan 3, 2025

Thanks! #871 fixes it on my end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants