8-bit-sheep / googleAnalyticsR

Use the Google Analytics API from R
https://8-bit-sheep.com/googleAnalyticsR/
Other
259 stars 76 forks source link

Error using ga_auth_setup() - "Error in if (file.exists(local_file)) { : argument is of length zero" #391

Closed ebeery11 closed 3 years ago

ebeery11 commented 3 years ago

What goes wrong

Per Issue 387, when using ga_auth() on new PC, receive Error: Could not authenticate via any gargle cred function

Per recommendation, followed recommended steps to create GCP and add client ID, but upon using ga_auth_setup() and selecting any of the options (1-5), receive Error in if (file.exists(local_file)) { : argument is of length zero

Steps to reproduce the problem

call ga_auth_setup(), select any option (1-5)

Expected output

Menu allowing setup of own client ID and secret.

Actual output

> ga_auth()
i 2021-10-28 14:32:50 > Default Google Project for googleAnalyticsR is set.  
 This is shared with all googleAnalyticsR users. 
 If making a lot of API calls, please visit: 
 https://gtm2.markedmondson.me/gar-setup 
 for instructions on setting your own Google Project 

Error: Could not authenticate via any gargle cred function
> ga_auth_setup()
i ==Welcome to googleAnalyticsR v1.0.1 setup==
This wizard will scan your system for setup options and help you with any that are missing. 
Hit 0 or ESC to cancel. 

1: Setup your own client ID and secret
2: Setup auto-authentication (OAuth2 email)
3: Create and download JSON service account key
4: Setup auto-authentication (JSON service account key)
5: Add a service account email or another email to your GA account

Selection: 1
-------------------------------------------------------------------------------------------------------------------------
Error in if (file.exists(local_file)) { : argument is of length zero
> 

Session Info

sessionInfo()
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

Random number generation:
 RNG:     Mersenne-Twister 
 Normal:  Inversion 
 Sample:  Rounding 

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

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

other attached packages:
[1] googleAnalyticsR_1.0.1

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7                later_1.3.0               pillar_1.6.3              compiler_4.1.1           
 [5] googleAuthR_1.4.0         tools_4.1.1               digest_0.6.28             jsonlite_1.7.2           
 [9] memoise_2.0.0             lifecycle_1.0.1           tibble_3.1.5              gargle_1.2.0             
[13] gtable_0.3.0              pkgconfig_2.0.3           rlang_0.4.11              DBI_1.1.1                
[17] cli_3.0.1                 rstudioapi_0.13           curl_4.3.2                fastmap_1.1.0            
[21] withr_2.4.2               dplyr_1.0.7               httr_1.4.2                rappdirs_0.3.3           
[25] generics_0.1.0            vctrs_0.3.8               fs_1.5.0                  grid_4.1.1               
[29] tidyselect_1.1.1          glue_1.4.2                R6_2.5.1                  fansi_0.5.0              
[33] measurementProtocol_0.1.0 whisker_0.4               tidyr_1.1.4               ggplot2_3.3.5            
[37] purrr_0.3.4               magrittr_2.0.1            usethis_2.1.0             scales_1.1.1             
[41] ellipsis_0.3.2            assertthat_0.2.1          colorspace_2.0-2          utf8_1.2.2               
[45] munsell_0.5.0             cachem_1.0.6              crayon_1.4.1             

Other Notes

ebeery11 commented 3 years ago

@MarkEdmondson1234 FYI I just gave up and solved this by doing a full fresh R and RStudio install. Seems to be working fine now...

MarkEdmondson1234 commented 3 years ago

Thanks, sorry I couldn't replicate it so couldn't help much, some weird edge case of files being there but not. Will keep an eye out for similar.