Hi,
I'm relatively new to Shiny apps and am currently encountering an issue when deploying a dashboard that is supposed to display a data frame. While the dashboard works perfectly locally, I encounter the error "Unable to connect to worker after 60.00 seconds; startup took too long." when I access online after deploying the app.
Here is the code snippet used to load the data frame, build the UI and server logic, and deploy the app:
# Load packages
library(shiny)
library(tidyverse)
library(data.table)
library(DT)
library(shinydashboard)
# Load data
df_full <- readRDS("df_full.rds")
# Create Dashboard
ui <- fluidPage(
titlePanel("Construct Validity Data Explorer"),
sidebarLayout(
sidebarPanel(
selectInput("countryInput", "Choose a Country:", choices = c("All" = "All", unique(df_full$Country))),
selectInput("numPartiesInput", "Number of Parties:", choices = c("All" = "All", unique(df_full$`Number of Parties`)))
),
mainPanel(dataTableOutput("validityTable"))
)
)
server <- function(input, output, session) {
filtered_data <- reactive({
temp_data <- df_full
if (input$countryInput != "All") {
temp_data <- temp_data[Country == input$countryInput]
}
if (input$numPartiesInput != "All") {
temp_data <- temp_data[`Number of Parties` == as.numeric(input$numPartiesInput)]
}
temp_data
})
output$validityTable <- renderDataTable({
filtered_data() %>% select(Country, `Number of Parties`, starts_with("Construct Validity"))
})
}
shinyApp(ui = ui, server = server)
# Deploy app
# Here, I just replaced the info for the purposes of this post
rsconnect::setAccountInfo(name='XXXX', token='XXX', secret='XXX')
rsconnect::deployApp(forceUpdate = "TRUE")
Attempts to diagnose and fix the issue include:
- Reviewing logs, which haven't indicated that there is a problem.
- Deploying a simpler app without data loading, which worked, suggesting the deployment process itself is not the issue.
- Testing with a significantly smaller data frame (1KB) to rule out issues related to data size of the original data frame (315KB), which also didn't work.
- Increasing the start-up timeout to 300s - the app still does not load.
I would appreciate any help with this! Thank you very much in advance!
Cheers,
Jakob
In case it helps, this is what the data structure looks like:
> head(df_full)
# A tibble: 6 × 7
Country `Number of Parties` `Party Combination` Construct Validity (Unw…¹ Construct Validity (…² Construct Validity (…³ Construct Validity (…⁴
<chr> <dbl> <chr> <dbl> <dbl> <dbl> <dbl>
1 Albania (2017) 2 Partia Socialiste e Shqiperise (PS), Partia Demokratike e Shqiperise (PD) 0.715 0.915 0.810 0.858
2 Albania (2017) 2 Partia Socialiste e Shqiperise (PS), Levizja Socialiste per Integrim (LSI) 0.664 0.743 0.675 0.593
3 Albania (2017) 2 Partia Socialiste e Shqiperise (PS), Partia Drejtesi, Integrim dhe Unitet (PDIU) 0.635 0.632 0.652 0.503
4 Albania (2017) 2 Partia Socialiste e Shqiperise (PS), Lista e Barabarte (LIBRA) 0.668 0.637 0.662 0.446
5 Albania (2017) 2 Partia Socialiste e Shqiperise (PS), Partia Socialdemokrate e Shqiperise (PSD) 0.590 0.554 0.605 0.361
6 Albania (2017) 2 Partia Demokratike e Shqiperise (PD), Levizja Socialiste per Integrim (LSI) 0.458 0.353 0.405 0.405
# ℹ abbreviated names: ¹`Construct Validity (Unweighted Spread)`, ²`Construct Validity (Unweighted Weighted)`, ³`Construct Validity (Unweighted Mean Distance)`, ⁴`Construct Validity (Weighted Mean Distance)````