Not able to authorize Google Sheet from Rstudio Server - r

I am not able to able to authorize Google Sheet using Rstudio Server. I have tried all the possible ways available on google but it didn't work.
I'm using below code.
library(googlesheets4)
gs4_auth()
# options(httr_oob_default=TRUE)
#gs4_deauth()
write_sheet(MyDF, "10XhCF-MmXw8gfIn4P0xg45MlIjna4YSfeq2I00gNhrt", sheet = 'Sheet1')
I have tried the same code in offline R by installing R on local machine it is working completely fine, but it doesn't work on R server.
I have tried all different browsers, but getting the below-mentioned error

I suspect that this is because you are loading both googlesheets and googlesheets4 in one session. Please try following steps:
Start a new environment on the server
Load only googlesheets4 then call gs4_auth() again.
If the error persist. Please tryto clean up the ~/.cache/gargle folder which store the last authorization process and try again.
Update
Please try clear up the cache and follow the step
Here is what happen on my server:

Related

Gmailr, authendication problem in one host but not others

gmailr authentication fails, after a fresh installation of Debian, only on one of my systems.
I have a script that run fine on two remote machines, but fails on my local machine.
I use this for authentication:
gm_auth_configure(path = "~/.credentials_main_mail.json")
gm_auth(email = "natsisthanasis#gmail.com",
cache = "~/.secret_main_mail")
print(gm_profile())
On my local machine, I get the error:
Error: Can't get Google credentials.
Are you running gmailr in a non-interactive session? Consider:
* Call `gm_auth()` directly with all necessary specifics.
I have tried interactive with Rstudio and R console, with the same result.
All scripts and credentials are always on sync between machines using unison. And all worked fine as cron jobs, before the new installation.
Does anyone have any idea on how to investigate further the problem or solve it?
I made it to work again, but I don't understand why, as I didn't have to do that on my other systems.
I used an answer from this stackoverflow question.
I used:
rappdirs::user_cache_dir("gargle")
library("gargle")
gargle_oauth_sitrep()
If someone has a short explanation, please enlighten me!

Authentication error with bq-auth in rstudio but not within r terminal session

I used to not having issues on this particular subject, but bigrquery::bq_auth is not working on my installed RStudio. Funnything is that within an R terminal session it works perfectly.
All started when I updated the R to R version 4.2.2 (2022-10-31).
This impacts me because I'm not being able to run a shiny application due to this problem.
Does any one knows what am I missing or has any clue where to look for? At least for start, because I am lost.
The code I am running is quite simple:
json="The_file.json"
bigrquery::bq_auth(path = jason)
The message:
*Error: Can't get Google credentials.
Are you running bigrquery in a non-interactive session? Consider:
Call bq_auth() directly with all necessary specifics.
*
As a matter of fact, I was just hoping to have the same answer in the R terminal session:
The bigrquery package is requesting access to your Google account.
Select a pre-authorised account or enter '0' to obtain a new token.
Press Esc/Ctrl + C to cancel.
Folks, I removed all packages and installed everything possible again. It worked. Sorry. I had tryed a lot and this last one ocurred me later. Regards all.

shiny app unreachable by shinyloadtest library

I am trying to load-test a shiny app on RStudio Connect. The shinyloadtest library claims to be able to load-test shiny apps on Rstudio Connect. I have installed this library and the shinnycannon app/library. I try to run
shinyloadtest::record_session("https://rsconnect-dev.the_rest.io/of/my/url/")
and receive the following error:
Target URL https://rsconnect-dev.the_rest.io/of/my/url/ does not appear to be a Shiny application.
The actual url is different but starts with https://rsconnect-dev. It appears that one of the internal functions ( detect.R) is saying that the url is the incorrect format. Have you found a way to bypass this?
You probably found a solution but for future shinyloadtest users it could help.
Shiny applications hosted on shinyapps.io can't be reached with shinyloadtest package.
Try with this shiny example url = "https://daattali.com/shiny/mimic-google-form/" it should works.

Shiny Datatable error - table id=DataTables_Table_1 - Ajax error

In my Shiny App, I have a Data.table implemented through the package data.table.
My Shiny app working absolutely fine on the local Server, however when I deployed it to Digital-ocean, I frequently get error as below :
DataTables warning: table id=DataTables_Table_1 - Ajax error. For more information about this error, please see http://datatables.net/tn/7
It is not that, I get this error every time, however quite frequently, and failed to repeat my experiment to regenerate that error. Appear like, this error comes up randomly?
I searched over the Internet, however, failed to get any concrete suggestion how to circumvent this problem arising on the Shiny application.
Any help will be highly appreciated.
Thanks,
Since you claim you deploy the shiny app on DigitalOcean and the app works well locally, I suspect the DT version on your server is not the latest.
You can check the version of DT by adding something like outputText("dt_version") to ui.R and output$dt_version <- renderText(packageVersion("DT")) to server.R.
If not, please install the developing version of DT via devtools::install_github('rstudio/DT') and try again (I bet you are using shiny-server, please remember to restart the server to ensure the newly installed package being loaded).

ShinyApp : Connection Reset By Peer

The shinyapp I built earlier was running fine in my old laptop. Recently I got a new laptop with Windows10. After setting up everything, I tried to run the app but it the browser opens and closes immediately with the error :
Listening on http://127.0.0.1:5004
ERROR: [on_request_read] connection reset by peer
I have also set chrome as default browser....
I deployed this app in shinyapps.io it is working fine there.
I tried few more simple apps in Rstudio but the same issue coming. Looks like the issue is more related to some setting in Windows10. Can someone help me please.
Thanks in Advance.....
Without details on the specific code, I'd share my personal experience with the same error for your reference. In my case, I used RStudio to create a shiny app that save data to a local directory on my computer, while I told R to output files to directory "response", I hadn't created such directory under the working directory so came the error. Simply creating the sub directory named "response" solve this right away. Or for moving your project files to different places in the future, you can just check whether the folder exists, if not, create one shall save you a lot of time.

Resources