diff --git a/NEWS.md b/NEWS.md index 5eaab667..a02ce35b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -35,6 +35,9 @@ will consider reintroduction of log streaming via rsconnect in Connect Cloud. (#1292) +* Updated non-streaming log retrieval to maintain compatibility with updates to + shinyapps.io's API. (#1294) + # rsconnect 1.7.0 * Added support for deploying from `manifest.json` files created by diff --git a/R/client-shinyapps.R b/R/client-shinyapps.R index a54a7516..b4380f6e 100644 --- a/R/client-shinyapps.R +++ b/R/client-shinyapps.R @@ -132,7 +132,7 @@ shinyAppsClient <- function(service, authInfo) { getLogs = function(applicationId, entries = 50, format = NULL) { path <- paste0("/applications/", applicationId, "/logs") - query <- paste0("count=", entries, "&tail=0") + query <- paste0("count=", entries) if (!is.null(format)) { # format=json returns a structured response. query <- paste0(query, "&format=", format) diff --git a/tests/testthat/test-client.R b/tests/testthat/test-client.R index 5d9d6390..03745329 100644 --- a/tests/testthat/test-client.R +++ b/tests/testthat/test-client.R @@ -10,6 +10,31 @@ test_that("connect cloud accounts create connect cloud clients", { expect_equal(client$service(), "connect.posit.cloud") }) +test_that("shinyapps getLogs does not include tail in query", { + captured_query <- NULL + local_mocked_bindings( + GET = function(service, authInfo, path, query = NULL, ...) { + captured_query <<- query + "fake log output" + } + ) + + client <- shinyAppsClient(service = list(), authInfo = list()) + client$getLogs("12345") + cat(captured_query) + expect_no_match(captured_query, "tail") + expect_match(captured_query, "count=50") + + client$getLogs("12345", entries = 100) + expect_no_match(captured_query, "tail") + expect_match(captured_query, "count=100") + + client$getLogs("12345", format = "json") + expect_no_match(captured_query, "tail") + expect_match(captured_query, "count=50") + expect_match(captured_query, "format=json") +}) + test_that("connect accounts create connect clients", { local_temp_config()