-
Notifications
You must be signed in to change notification settings - Fork 83
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
showLogs() does not run if it does not find the deployment #989
Comments
Likely the same cause as #985 |
@hadley it sounds as if a number of folks were using some of the shinyapps.io helpers to inspect and monitor their applications without deployment records on-disk in a |
Interesting. How is it supposed to figure out what app they're interested in? |
So that ended up using the directory name? |
@alvarosantamariagomez - What was your working directory you used when calling |
@hadley - #980 and https://community.rstudio.com/t/shinyapps-io-deploy-error-409-application-exists-with-name/170488/7 also speak of similar problems. There was a separate problem with |
I have several apps deployed, but I check the logs of only one app. It could be useful to have that possibility back in the latest version, though simply copying the app folder (from the other machine where I develop & deploy) also solved my problem. hope that helps |
Thanks for all that context, @alvarosantamariagomez. |
This issue also corresponds to customer ticket 94407. |
I was working with a customer on a shinyapps.io ticket and ran into this issue. I found that if we just had the option to use the My modified function I sent to a customer to get them up and running with their scripts included a new deployment <- findDeployment(appPath = appPath, appName = appName,
server = server, account = account) showLogs <- function(appFile = NULL, appName = NULL,
account = NULL, server = NULL,
entries = 50, streaming = FALSE,
verifyDeployment = TRUE) {
if (verifyDeployment) {
deployment <- findDeployment(appPath = appPath, appName = appName,
server = server, account = account)
} else {
if (is.null(appName) | is.null(account) | is.null(server)) {
stop('`appName`, `account`, and `server` must be specified if `verifyDeployment` is `FALSE`.')
}
deployment <- list(
'account' = account,
'server' = server,
'name' = appName)
}
accountDetails <- rsconnect::accountInfo(deployment$account, deployment$server)
client <- rsconnect:::clientForAccount(accountDetails)
application <- rsconnect:::getAppByName(client, accountDetails, deployment$name)
if (is.null(application))
stop("No application found. Specify the application's directory, name, ",
"and/or associated account.")
if (streaming) {
skip <- 0
repeat {
tryCatch({
rsconnect:::streamApplicationLogs(accountDetails, application$id,
entries, skip)
entries <- 1
skip <- 1
}, error = function(e) {
if (!identical(e$message, "transfer closed with outstanding read data remaining")) {
stop(e)
}
})
}
}
else {
logs <- client$getLogs(application$id, entries)
cat(logs)
}
} This was just to get them going but it does provide the workaround these folks are looking for to manage their servers. I have recommended a format similar to the one below for several customers and an example of how they are using this function in practice. #set to home to show we can be in ANY directory now
setwd('~')
#Grab a vector of 5 application names to test with
appNames <- rsconnect::applications(account ='testaccountjacpete', server = 'shinyapps.io')[['name']][1:5]
#Set the output location
file_loc <- '~/Downloads'
#Loop over the application names and save a copy of the logs using the modified `showLogs()` function
for (appName in appNames) {
outputFile <- paste0(appName, "-logs_",format(Sys.time(), "%Y-%m-%d_%H-%M"), ".txt", sep = "")
capture.output(
{
showLogs(appName = appName, account ='testaccountjacpete', server = 'shinyapps.io',
entries = 1500, verifyDeployment = FALSE)
},
file = file.path(file_loc, outputFile)
)
} |
@alvarosantamariagomez - Could you test the development version of rsconnect to see if your problem has been resolved? remotes::install_github("rstudio/rsconnect") |
@aronatkins problem solved in showLogs() without the need of having the deployed app folder, thanks |
After the update to 1.0.2 I cannot run
rsconnect::showLogs()
on a different machine that the one I use to develop and deploy.showLogs() says it doesn't find any deployment.
This was not a problem before the last version change. Before the change, only the account (token) and the app details was enough to run showLogs().
A patch to this problem is to copy the app folder from the machine I use to deploy into the machine I use to run showLogs().
It's not a very clean solution, but at least showLogs() now finds the deployment and works again.
It would be nice if showLogs() could run anywhere independently of the app/deployment folder, as it was the case before.
Thanks, bye.
The text was updated successfully, but these errors were encountered: