natverse / hemibrainr

Code for working with data from Janelia FlyEM's hemibrain project
https://natverse.github.io/hemibrainr/
7 stars 4 forks source link

The `app` argument of `gs4_auth_configure()` is deprecated #57

Open callestreets opened 1 year ago

callestreets commented 1 year ago

I have been successfully using hemibrainr to update flywire IDs in a master google sheet for quite some time. However, today when running library(hemibrainr) I received the following error/ warning which suggested I report the issue here:

Error in gs4_auth_configure(client = app, path = path, api_key = api_key) : 
  missing(client) || is.null(client) || inherits(client, "gargle_oauth_client") is not TRUE
In addition: Warning message:
The `app` argument of `gs4_auth_configure()` is deprecated as of googlesheets4 1.1.0.
ℹ Please use the `client` argument instead.
ℹ The deprecated feature was likely used in the hemibrainr package.
  Please report the issue at <https://github.com/flyconnectome/hemibrainr/issues>.
This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated. 

Hemibrainr still works to update IDs that are passed to it directly in R, but when trying to update IDs in my google sheets using flywire_ids_update(), it gives the following error now:

Error in (function(x, i, exact) if (is.matrix(i)) as.matrix(x)[[i]] else .subset2(x,  : 
  object 'fw.id' not found

_hemibrainr v0.5.0; googlesheets4 v1.1.0; RStudio 2022.02.2+485 "Prairie Trillium" Release (8acbd38b0d4ca3c86c570cf4112a8180c48cc6fb, 2022-04-19) for macOS Mozilla/5.0 (Macintosh; Intel Mac OS X 12_60) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.10 Chrome/69.0.3497.128 Safari/537.36

callestreets commented 1 year ago

In case it's helpful, here is the output after calling lifecycle::last_lifecycle_warnings() (as suggested in the warning above):

Backtrace:
     ▆
  1. └─base::library(hemibrainr)
  2.   ├─base::tryCatch(...)
  3.   │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
  4.   │   └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
  5.   │     └─base (local) doTryCatch(return(expr), name, parentenv, handler)
  6.   └─base::attachNamespace(ns, pos = pos, deps, exclude, include.only)
  7.     └─base (local) runHook(".onAttach", ns, dirname(nspath), nsname)
  8.       ├─base::tryCatch(fun(libname, pkgname), error = identity)
  9.       │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
 10.       │   └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
 11.       │     └─base (local) doTryCatch(return(expr), name, parentenv, handler)
 12.       └─hemibrainr (local) fun(libname, pkgname)
 13.         ├─base::try(hemibrainr_google_login())
 14.         │ └─base::tryCatch(...)
 15.         │   └─base (local) tryCatchList(expr, classes, parentenv, handlers)
 16.         │     └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
 17.         │       └─base (local) doTryCatch(return(expr), name, parentenv, handler)
 18.         └─hemibrainr:::hemibrainr_google_login()
 19.           └─googlesheets4::gs4_auth_configure(app = google_app, api_key = hemibrainr_ghseets_api_key)
jefferis commented 1 year ago

In the short term, I guess you can wind back the version of googlesheets4 package. @alexanderbates I'm not sure if you can take a look at this – perhaps it will bite you soon?

callestreets commented 1 year ago

Thank you for the quick reply and for your help! I had to wind back googlesheets4 (to version 1.0.1) and googledrive (to version 2.0.0) to get the error/ warning to disappear. But unfortunately, I still get the same error when trying to update IDs in google sheets.

I am still able to read from google sheets using the read_range() function from the googlesheets4 package without a problem, and I even tried changing the column names in my google sheet from "root_id" to "fw.id", but the following error still persists when running flywire_ids_update() on the selected sheet:

Error in (function(x, i, exact) if (is.matrix(i)) as.matrix(x)[[i]] else .subset2(x,  : 
  object 'fw.id' not found
jefferis commented 1 year ago

Hmm that's odd. Can I check that you have restarted R after winding back the googlesheets4 package?

callestreets commented 1 year ago

Yes, I restarted R and still got the same result. One thing I noticed a while ago which is rather strange to me, is that if I run library(googlesheets4) and gs4_auth() before running library(hemibrainr), I am able to select my pre-authorized google account like usual. But if I first run library(hemibrainr) and then gs4_auth(), I get a browser window indicating the following:

Screen Shot 2023-04-17 at 3 24 13 PM

I noticed this some time ago, but up until now I was still able to update IDs as long as I ran library(googlesheets4) and gs4_auth()before library(hemibrainr). I don't know if maybe that just points to a mistake I have somewhere in my setup or if it could have anything to do with what I am experiencing now (I am still relatively new to coding...).