tidyverse / googledrive

Google Drive R API
https://googledrive.tidyverse.org/
Other
322 stars 47 forks source link

drive_auth() throws `Error in value[[3L]](cond) : attempt to apply non-function` #437

Closed paladinic closed 1 year ago

paladinic commented 1 year ago

I recently rebooted my Windows laptop and started getting the following error when trying to run drive_auth:

> drive_auth(email = "xxx@gmail.com",path = "xxx.json")
Error in value[[3L]](cond) : attempt to apply non-function

Until the reboot, I could run the shiny app that includes this line but now it breaks there. I tried reinstalling openssl, installing RTools, and restarting the machine, as per suggestions provided for similar situations, with no luck.

Any other suggestions would be very appreciated.

Here is the output of my SessionInfo.

> sessionInfo()
R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.utf8 
[2] LC_CTYPE=English_United Kingdom.utf8   
[3] LC_MONETARY=English_United Kingdom.utf8
[4] LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.utf8    

time zone: Europe/Berlin
tzcode source: internal

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

other attached packages:
 [1] zoo_1.8-12               tis_1.39                
 [3] forcats_1.0.0            stringr_1.5.0           
 [5] dplyr_1.1.2              purrr_1.0.1             
 [7] readr_2.1.4              tidyr_1.3.0             
 [9] tidyverse_2.0.0          tibble_3.2.1            
[11] sjmisc_2.8.9             shinyWidgets_0.7.6      
[13] shinythemes_1.2.0        shinyStore_0.1.0        
[15] shinyjs_2.1.0            shinydashboardPlus_2.0.3
[17] shinydashboard_0.7.2     shinycssloaders_1.0.0   
[19] shinyalert_3.0.0         shiny_1.7.4.1           
[21] scales_1.2.1             rlist_0.4.6.2           
[23] rhandsontable_0.3.8      reshape2_1.4.4          
[25] readxl_1.4.2             plotly_4.10.2           
[27] ggplot2_3.4.2            lubridate_1.9.2         
[29] linea_0.1.2              gtrendsR_1.5.1          
[31] googledrive_2.1.1        googleAuthR_2.0.1       
[33] firebase_1.0.2           DT_0.28                 
[35] countrycode_1.5.0        colourpicker_1.2.0      
[37] httr_1.4.6              

loaded via a namespace (and not attached):
 [1] tidyselect_1.2.0   sjlabelled_1.2.0   viridisLite_0.4.2 
 [4] fastmap_1.1.1      lazyeval_0.2.2     promises_1.2.0.1  
 [7] digest_0.6.32      timechange_0.2.0   mime_0.12         
[10] lifecycle_1.0.3    ellipsis_0.3.2     magrittr_2.0.3    
[13] compiler_4.3.1     rlang_1.1.1        sass_0.4.6        
[16] tools_4.3.1        utf8_1.2.3         data.table_1.14.8 
[19] askpass_1.1        htmlwidgets_1.6.2  plyr_1.8.8        
[22] RColorBrewer_1.1-3 abind_1.4-5        miniUI_0.1.1.1    
[25] jose_1.2.0         withr_2.5.0        grid_4.3.1        
[28] fansi_1.0.4        xtable_1.8-4       colorspace_2.1-0  
[31] insight_0.19.3     cli_3.6.1          generics_0.1.3    
[34] rstudioapi_0.15.0  tzdb_0.4.0         cachem_1.0.8      
[37] assertthat_0.2.1   cellranger_1.1.0   base64enc_0.1-3   
[40] vctrs_0.6.3        jsonlite_1.8.5     carData_3.0-5     
[43] car_3.1-2          hms_1.1.3          jquerylib_0.1.4   
[46] glue_1.6.2         stringi_1.7.12     gtable_0.3.3      
[49] later_1.3.1        munsell_0.5.0      pillar_1.9.0      
[52] htmltools_0.5.5    openssl_2.0.6      R6_2.5.1          
[55] lattice_0.21-8     openxlsx_4.2.5.2   memoise_2.0.1     
[58] gargle_1.5.1       httpuv_1.6.11      bslib_0.5.0       
[61] Rcpp_1.0.10        zip_2.3.0          fs_1.6.2          
[64] pkgconfig_2.0.3  

Do let me know if anything else is needed, and thank you in advance.

jennybc commented 1 year ago

Thanks for reporting, this is a problem in gargle.

But it's an error in throwing an error 😅

There is essentially no legitimate use of drive_auth(email = ,path = ), which is what we are trying (and currently failing) to inform you of.

It doesn't make sense to supply the email and path arguments at the same time. What are you trying to accomplish?

paladinic commented 1 year ago

Thank you for your reply!

I am trying to let a shiny app access google drive folders and files that belong to my user (linked to the json file), without the users needing to sign in.

The code used to work until the reboot mentioned above. Ultimately this process would operate on Google Cloud with a service account which followed the same implementation.

I realised that adjusting the path specified for the JSON file resolved the issue!

Thank you for pointing out the redundancy in specifying both path and email! You are a hero Jenny

paladinic commented 1 year ago

Just to clarify. Before adjusting the path, even without the path input, the function was still outputting the error mentioned above.

Thanks again!

jennybc commented 1 year ago

Can you show me exactly what you mean by this?

Before adjusting the path, even without the path input, the function was still outputting the error mentioned above.

Ideally, show the code and the error. Thanks!