Hi,
I am getting an error in accessing the RedCap API using the REDCapR package on RStudio Cloud. Interestingly, I do not get an error when using this on my local machine.
Here is what I am trying to do:
df <- redcap_read(redcap_uri = "https://redcap.xxx.edu/api/",
token = "123456789ABCDEFGHIJKL")$data
Here is the traceback of the error:
Error in curl::curl_fetch_memory(url, handle = handle) :
Timeout was reached: [redcap.ucsd.edu] Connection timed out after 10001 milliseconds
8.
curl::curl_fetch_memory(url, handle = handle)
7.
request_fetch.write_memory(req$output, req$url, handle)
6.
request_fetch(req$output, req$url, handle)
5.
request_perform(req, hu$handle$handle)
4.
httr::POST(url = redcap_uri, body = post_body, config = config_options,
httr::user_agent("OuhscBbmc/REDCapR"))
3.
kernel_api(redcap_uri, post_body, config_options)
2.
REDCapR::redcap_metadata_read(redcap_uri = redcap_uri, token = token,
verbose = verbose, config_options = config_options)
1.
redcap_read(redcap_uri = "https://redcap.xxx.edu/api/", token = "123456789ABCDEFGHIJKL")
Here is the session info:
R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8
[6] LC_MESSAGES=C.UTF-8 LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] httr_1.4.4 broom_1.0.1 compareGroups_4.5.1 googlesheets4_1.0.1 REDCapR_1.1.0 forcats_0.5.2
[7] stringr_1.4.1 dplyr_1.0.9 purrr_0.3.4 readr_2.1.2 tidyr_1.2.0 tibble_3.1.8
[13] ggplot2_3.3.6 tidyverse_1.3.2 summarytools_1.0.1
loaded via a namespace (and not attached):
[1] matrixStats_0.62.0 fs_1.5.2 lubridate_1.8.0 webshot_0.5.3 tools_4.2.1 backports_1.4.1
[7] utf8_1.2.2 R6_2.5.1 DBI_1.1.3 colorspace_2.0-3 nnet_7.3-17 withr_2.5.0
[13] tidyselect_1.1.2 curl_4.3.2 compiler_4.2.1 chron_2.3-57 cli_3.3.0 rvest_1.0.3
[19] HardyWeinberg_1.7.5 flextable_0.7.3 mice_3.14.0 xml2_1.3.3 officer_0.4.3 scales_1.2.1
[25] checkmate_2.1.0 systemfonts_1.0.4 digest_0.6.29 svglite_2.1.0 rmarkdown_2.16 base64enc_0.1-3
[31] pkgconfig_2.0.3 htmltools_0.5.3 dbplyr_2.2.1 fastmap_1.1.0 rlang_1.0.4 readxl_1.4.1
[37] rstudioapi_0.14 pryr_0.1.5 generics_0.1.3 jsonlite_1.8.0 zip_2.2.0 magrittr_2.0.3
[43] kableExtra_1.3.4 rapportools_1.1 Matrix_1.4-1 Rcpp_1.0.9 munsell_0.5.0 fansi_1.0.3
[49] gdtools_0.2.4 lifecycle_1.0.1 yaml_2.3.5 stringi_1.7.8 MASS_7.3-57 plyr_1.8.7
[55] grid_4.2.1 parallel_4.2.1 crayon_1.5.1 lattice_0.20-45 haven_2.5.1 splines_4.2.1
[61] pander_0.6.5 hms_1.1.2 magick_2.7.3 knitr_1.40 pillar_1.8.1 tcltk_4.2.1
[67] uuid_1.1-0 reshape2_1.4.4 codetools_0.2-18 reprex_2.0.2 glue_1.6.2 evaluate_0.16
[73] data.table_1.14.2 modelr_0.1.9 vctrs_0.4.1 tzdb_0.3.0 cellranger_1.1.0 gtable_0.3.0
[79] assertthat_0.2.1 xfun_0.32 Rsolnp_1.16 viridisLite_0.4.1 survival_3.3-1 googledrive_2.0.0
[85] gargle_1.2.0 truncnorm_1.0-8 writexl_1.4.0 ellipsis_0.3.2
PS: My institution needs a VPN to be connected for me to be able to access the API. When the VPN is connected, code above works for my local PC, but not on RStudio Cloud.
Any idea what is going wrong?