Giter VIP home page Giter VIP logo

Comments (8)

jennybc avatar jennybc commented on July 18, 2024

I would add options(gargle_verbosity = "debug") to your debugging strategy, just to expose more information.

One hypothesis is that the user associated with the Task Scheduler job doesn't have permission to use the token. I would add some print debugging around: does the token (file) I need exist? what are my permissions with respect to that file?

from gmailr.

JeffreyCHoover avatar JeffreyCHoover commented on July 18, 2024

Hi Jenny, thanks for your help on this!

I used file.access() with the Task Scheduler job to check the permissions of the token file. It indicated that the token file existed and that I had read, write, and execute access to the token file.

I deleted the .secret cache folder and manually ran the script to re-authenticate gmailr, but I'm still having the same issue.

One thing I keep noticing in the debugging output with options(gargle_verbosity = "debug") is that it appears gm_auth() isn't able to find a matching token in the cache.

[removed preceding code for readability]
no matching token in the cache
initiating new token
Error caught by `token_fetch()`:
OAuth2 flow requires an interactive session.
Error: Can't get Google credentials.
Are you running gmailr in a non-interactive session? Consider:
  * Call `gm_auth()` directly with all necessary specifics.
Execution halted

I'm not really sure why that would be. It finds a match when I run the script manually. It finds a match when I provides the cache, scopes, and email to token_fetch(). But for whatever reason, it's not finding a match whenever I run the script through Task Scheduler.

from gmailr.

jennybc avatar jennybc commented on July 18, 2024

If add more debugging to gargle, are you in a position to install a dev version of gargle so we can dig into the cache miss?

from gmailr.

JeffreyCHoover avatar JeffreyCHoover commented on July 18, 2024

We can. Let me know which dev version to install, and I can use that to provide more info on the cache miss.

from gmailr.

jennybc avatar jennybc commented on July 18, 2024

The current dev version of gargle has more debugging statements that reveal the pieces of info that go into the strings used to key the tokens. Hopefully that will reveal what is different when you are making the token vs. when you are trying to retrieve it.

I would install with pak::pak("r-lib/gargle") but you could also use remotes::install_github("r-lib/gargle") or whatever your preferred method is for installing dev packages from GitHub.

from gmailr.

JeffreyCHoover avatar JeffreyCHoover commented on July 18, 2024

Thanks for providing that dev version! When I installed the dev version, I was able to successfully run the job through Task Scheduler, and the email was sent as intended. Just to double check, I re-installed the version of gargle from Cran (gargle 1.4.0), and I got the same error message that I was getting before. It looks like something included in the dev version has addressed the issue.

For whatever it's worth, the new debugging info that's included in the dev version looks really good. Even though I didn't get to use it to troubleshoot the problem, it looks like it would have been really helpful.

from gmailr.

jennybc avatar jennybc commented on July 18, 2024

Well, that's very interesting!

There is no change in dev gargle that I explicitly expected to address/fix this. But I guess there's one that might be related (r-lib/gargle@0b45026). I guess we'll just take the win!

I plan to release gargle very soon. Can this be closed now?

from gmailr.

JeffreyCHoover avatar JeffreyCHoover commented on July 18, 2024

I think we're good to close. Thank you again for all of your help on this!

from gmailr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.