I am trying to deploy a shiny app via shinyapp.io. Unfortunately I am completely new to shiny and this is my first project. Basically, what the app is supposed to do is read a google spreadsheet that I keep in my google drive and do some analysis on the content which I then want to provide to somebody else.
I can give you the code I am using, since it's fairly short:
packages <- c("shiny", "googlesheets4", "googledrive", "tidyr")
lapply(packages, require, character.only = TRUE)
ui <- fluidPage("Just some test title",
textOutput("test_output"))
server <- function(input, output) {
output$total <-renderText({df <- drive_get("Desired_SpreadSheet") %>%
read_sheet(sheet = "Desired Sheet") %>% drop_na()
test_output = sum(df$numeric_column)
print(paste0("This should be some number: ", test_output))
})
}
shinyApp(ui = ui, server = server)
And if I run this locally, I get the desired output. However, when I try deploying via shinyapp.io by using the following code:
rsconnect::deployApp(dirname(rstudioapi::getSourceEditorContext()$path))
The dashboard just features the right title and then the error message
Error: An error has occurred. Check your logs or contact the app author for clarification.
So I conclude, he deployment works for all lines that do not require content from the google spreadsheet but somehow accessing this sheet does not work. Also I don't even know how to access the logs for this to debug myself.
I'd be grateful for any suggestions how to fix this!
Cheers
You can check the logs by going to shinyapps and logging in. There will be a dashboard with your apps and a tab for the logs.
However, I suspect the problem is that ShinyApps doesn't have the authorisation to access your Google Drive / Google Sheet, so you need to set that up.
I struggled with this myself but got it working here.