rdrop2 icon indicating copy to clipboard operation
rdrop2 copied to clipboard

Token auto-refresh hangs on windows machine

Open collinschwantes opened this issue 2 years ago • 2 comments

Using the process from #201, I generated auto-refreshing "long term tokens". The process runs smoothly on unix machines; however, when working on windows machines the auto-refresh hangs and eventually gives an error. The token is refreshed during the process but for some reason the function errors out.

Running:

library(rdrop2)

rdrop2::drop_auth(rdstoken = "auth/db_token.rds")

rdrop2::drop_download("some/dropbox/file.csv", local_path = "Dropbox_data.csv", overwrite = TRUE)

Returns:

Auto-refreshing stale OAuth token.
Error in .rs.parsePackageDependencies(contents, extension) :
  object 'partition_yaml_front_matter' not found
Error in .rs.parsePackageDependencies(contents, extension) :
  object 'partition_yaml_front_matter' not found
Error in .rs.parsePackageDependencies(contents, extension) :
  object 'partition_yaml_front_matter' not found

Expected Behaviour

Expect the token refresh process to occur without generating an error

Actual Behaviour

Token is refreshed but function returns an error.

Account Type

Dropbox Business Advanced

Session Info

Replace the output below (inside the backticks) with output from devtools::session_info() (or sessionInfo() if you don't have devtools installed)

R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base
other attached packages:
 [1] here_1.0.1      httpuv_1.6.5    rdrop2_0.8.2.1  janitor_2.1.0
 [5] forcats_0.5.1   stringr_1.4.0   purrr_0.3.4     readr_2.1.2
 [9] tidyr_1.2.0     tibble_3.1.6    ggplot2_3.3.5   tidyverse_1.3.1
[13] dplyr_1.0.8     airtabler_0.1.6
loaded via a namespace (and not attached):
 [1] httr_1.4.2                 jsonlite_1.8.0
 [3] assertive.sets_0.0-3       modelr_0.1.8
 [5] assertthat_0.2.1           askpass_1.1
 [7] assertive.data_0.0-3       renv_0.14.0
 [9] cellranger_1.1.0           yaml_2.3.5
[11] pillar_1.7.0               backports_1.4.1
[13] glue_1.6.2                 digest_0.6.29
[15] [assertive.data.uk](http://assertive.data.uk/)_0.0-2    assertive.matrices_0.0-2
[17] assertive.types_0.0-3      promises_1.2.0.1
[19] rvest_1.0.2                snakecase_0.11.0
[21] colorspace_2.0-3           htmltools_0.5.2
[23] pkgconfig_2.0.3            broom_0.7.12
[25] assertive.properties_0.0-4 [assertive.data.us](http://assertive.data.us/)_0.0-2
[27] assertive.reflection_0.0-5 haven_2.4.3
[29] scales_1.1.1               later_1.3.0
[31] assertive_0.3-6            tzdb_0.2.0
[33] openssl_2.0.0              generics_0.1.2
[35] ellipsis_0.3.2             withr_2.5.0
[37] assertive.code_0.0-3       cli_3.2.0
[39] magrittr_2.0.2             crayon_1.5.1
[41] readxl_1.4.0               assertive.strings_0.0-3
[43] evaluate_0.15              fs_1.5.2
[45] fansi_1.0.2                assertive.numbers_0.0-2
[47] xml2_1.3.3                 tools_4.1.1
[49] hms_1.1.1                  lifecycle_1.0.1
[51] assertive.files_0.0-2      munsell_0.5.0
[53] reprex_2.0.1               compiler_4.1.1
[55] rlang_1.0.2                grid_4.1.1
[57] rstudioapi_0.13            assertive.models_0.0-2
[59] assertive.base_0.0-9       rmarkdown_2.13
[61] gtable_0.3.0               codetools_0.2-18
[63] DBI_1.1.2                  curl_4.3.2
[65] assertive.datetimes_0.0-3  R6_2.5.1
[67] lubridate_1.8.0            knitr_1.37
[69] fastmap_1.1.0              utf8_1.2.2
[71] rprojroot_2.0.2            stringi_1.7.6
[73] Rcpp_1.0.8.3               vctrs_0.3.8
[75] dbplyr_2.1.1               tidyselect_1.1.2
[77] xfun_0.30

collinschwantes avatar Jun 10 '22 16:06 collinschwantes

A little hacky but downloading a file first seems to resolve the issues with uploads not properly refreshing the token.

refresh_db_token<-function(path = "auth/db_token.rds"){ 
  rdrop2::drop_auth(rdstoken = path, cache = FALSE)
  # download a small file to get the token to refresh properly. Allows upload functions to work. 
  rdrop2::drop_download("tinyFile.csv",local_path = here("Dropbox_data"), overwrite = TRUE)
  file.remove(here("Dropbox_data/tinyFile.csv"))
  }

collinschwantes avatar Aug 19 '22 15:08 collinschwantes

I had the same issue of it hanging but now this hack is working for me,

tadhg-moore avatar Sep 20 '22 14:09 tadhg-moore