Closed Vimal048 closed 2 years ago
I encountered a similar issue when using cronR(essentially MacOS version of taskScheduleR) and posted in #224. I'd recommend seeing Jenny's advice there and see if anything applies.
In essence it boiled down to a path issue when i was working interactively vs. when the scheduler went to run the script. I'm going to copy some of Jenny's reply here, but would also recommend viewing the whole thread as well as that may help:
From Jenny in #224:
Anytime I hear "cron job" and "auth not working", I suspect a path problem. You need to insert some assertions about file existence, print statements of getwd() and list.files(), etc. into your cron job to convince yourself 110% that you understand what the working directory is when those calls like drive_auth() are made.
I concur with @cpilat97's troubleshooting advice.
Hi All,
I am not able to run my r-scripts from the windows task scheduler while running manually the same scripts are running and while running through task scheduler getting below error.
! Can't get Google credentials. i Are you running googlesheets4 in a non-interactive session? Consider:
gs4_deauth()
to prevent the attempt to get credentials.gs4_auth()
directly with all necessary specifics. i See gargle's "Non-interactive auth" vignette for more details: i https://gargle.r-lib.org/articles/non-interactive-auth.htmlDone with all the possible troubleshoot but the issue still persists
Please request you help for the same.
Matrix products: default
locale: [1] LC_COLLATE=English_India.1252 LC_CTYPE=English_India.1252
[3] LC_MONETARY=English_India.1252 LC_NUMERIC=C
[5] LC_TIME=English_India.1252
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] googledrive_2.0.0 gargle_1.2.0 googlesheets4_1.0.0 [4] stringr_1.4.0 Rcpp_1.0.8 dplyr_1.0.8
[7] RMySQL_0.10.23 DBI_1.1.2 data.table_1.14.2
loaded via a namespace (and not attached): [1] rstudioapi_0.13 magrittr_2.0.2 rappdirs_0.3.3 tidyselect_1.1.2 [5] R6_2.5.1 rlang_1.0.1 fansi_1.0.2 httr_1.4.2
[9] tools_4.1.2 utf8_1.2.2 cli_3.2.0 withr_2.4.3
[13] ellipsis_0.3.2 tibble_3.1.6 lifecycle_1.0.1 crayon_1.5.0
[17] purrr_0.3.4 vctrs_0.3.8 fs_1.5.2 curl_4.3.2
[21] glue_1.6.1 stringi_1.7.6 compiler_4.1.2 pillar_1.7.0
[25] cellranger_1.1.0 generics_0.1.2 jsonlite_1.8.0 pkgconfig_2.0.3