-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in googledrive::drive_auth()
: scheduled jobs accessing googlesheets are failing on Rstudio-server
#425
Comments
Looks like there's a typo in the option name. BAD, NO: More observations:
I suspect the code should look more like this (untested, obviously):
|
When I run the above code console/terminal it works fine. But when I schedule it, the logs are:
if I schedule my previous code
the logs are
I have another doubt. How was it able to run in console/terminal even with incorrect spelling of function name? |
It was a misspelled option name, not function name. You can set any options you want, but if the name is misspelled, it just won't have the effect you intend. I think you should add some print statements to the script to confirm the existence of the cache path and list its contents. Is the cron job's idea of |
This time I tried giving full path to gargle cache and also few print statements along with some info. code:
logs when run in console:( this time it threw some warning kind of stufff. Hopefully this leads to something)
logs when scheduled the job, the job failed at drive_auth()
|
Assuming you're running the same code in both scenarios, we're getting a lot less information from the cron job, which is where we really need the info. How are you capturing this? Feels like a standard out vs standard error problem (re: this missing info). There's still a lot extraneous code, along the lines of what I pointed out before (#425 (comment)), which just adds noise and is making this harder. This is still my leading hypothesis:
I see you changed to an absolute path, but this could still be a permissions problem, if the cron job is running as a user that doesn't have access to the cache. That would be revealed if we saw what happened when listing the files in the cache. |
Can you print the gargle version? Could the cron job somehow be using an older version of gargle? |
I would get even more debugging info to compare by setting:
|
tried code:
The logs look hopeful
|
My leading hypothesis is that, in the scheduled context, its defaulting to a different OAuth client, which would explain the cache miss:
However the known cause for that problem has been fixed: Maybe your cron job is not a sub-process of RStudio at all? You could try setting this option explicitly to force the use of a web OAuth client, which I can tell is what your cached tokens are associated with.
|
Once you do auth explicitly or some action that requires auth implicitly, |
Thanks a lot! the |
The possibility of setting |
Hi @jennybc ,
continuation from #424
I am using rstudio-server, community version, installed on ubuntu 20.04.
I am running an R script which reads an excel file. I have done the authentication and tokens are generated. I am using googledrive and googlesheets4 libraries.
We installed the latest version of gargle(1.4.0).
This time , jobs that access googlesheets are running fine from console/terminal but failing when we schedule them from rstudio-server
logs of the scheduled job
Thanks in advance.
The text was updated successfully, but these errors were encountered: