I have a problem that is exactly like this
but the solution mentioned in that post does not work for me.
It is a markdown document that usually takes a minute or two to run on my PC.
It runs on Shinyapps and generates a html that fails to download.
The log says
Warning: Error in is_remote_protocol_ok: Cannot find headless Chrome after 20 attempts
This is my Server side code.
output$report <- downloadHandler(
# For PDF output, change this to "report.pdf"
filename = "report.pdf",
content = function(file) {
# Copy the report file to a temporary directory before processing it, in
# case we don't have write permissions to the current working dir (which
# can happen when deployed).
tempReport <- file.path(here("temp"), "report_2021.Rmd")
file.copy("report_2021.Rmd", tempReport, overwrite = TRUE)
# Set up parameters to pass to Rmd document
params <- list(Team = input$1, Level = input$Level, Year = input$Year,
Competition = input$4, Game = input$5)
# Knit the document, passing in the `params` list, and eval it in a
# child of the global environment (this isolates the code in the document
# from the code in this app).
library(rmarkdown)
out <- pagedown::chrome_print( render(tempReport, params = params,
envir = new.env(parent = globalenv())),
extra_args = c("--disable-gpu",
"--no-sandbox"),
wait = 15,
timeout = 300,
async = T,
verbose = TRUE
)
file.rename(out, file)
shiny::withProgress(
message = paste0("Downloading Report"),
value = 0,
{
shiny::incProgress(1/10)
Sys.sleep(1)
shiny::incProgress(5/10)
}
)
}
)