So I had an R Shiny dashboard that was running totally fine with no errors or warnings when run locally using RStudio. However, when deployed to a shiny server it was not working at all. The UI would load but I could see the server code was not running at all (I put lots of error logs throughout the code so I could see the server code was not running). Beyond this, there were no errors to the server Shiny logs beyond “Execution halted”.
So I worked out what was causing the problem and just wanted to know why this would work locally but not when deployed.
The problem was with this part of the UI code that was causing the problem (worked out through just trial and error of commenting out sections of code):
div(id = "longitudinal_dass21",fluidRow(h4("DASS-21", style = "color: #3279b7")),
fluidRow(htmlOutput("longitudinal_severity_interpretation_k10")),
fluidRow(style = "height:450px",withSpinner(plotOutput("dass21_longitudinal"), type = 5, size = 0.3, color = "#3d90db")),
fluidRow(align = 'right', downloadButton('dass21_longitudinal_button')),
br(),
),
div(id = "longitudinal_pwi",fluidRow(h4("PWI-A", style = "color: #3279b7")),
fluidRow(htmlOutput("longitudinal_severity_interpretation_k10")),
fluidRow(style = "height:450px",withSpinner(plotOutput("pwi_longitudinal"), type = 5, size = 0.3, color = "#3d90db")),
fluidRow(align = 'right', downloadButton('pwi_longitudinal_button')),
br(),
),
More specifically, it was with this reactive text output: "longitudinal_severity_interpretation_k10"
where it is used in both the different divs but the text would change dependent upon an input. The divs in the text were also hidden / shown using ShinyJS dependent upon an input and they were never shown at the same time. The reactive text was as follows:
output$longitudinal_severity_interpretation_k10 <- renderUI({
HTML(paste("The plot below shows the percentage of clients in each severity rating for each month for the ", sub('.*\,','', Assessment_Name()),". Given that small sample sizes in each month could distort the overview of severity percentages, there is a filter on the left that allows you to only include data when the sample size in each month is greater than or equal to what you specify. Use the button below the plot to download a PNG file of the plot.<br><br>", sep=""))})
So I’m trying to work out if there is a problem with my use of the same reactive text within each div. Would this be expected to cause a fatal error when run on a server (with no error output) but run totally fine locally? I am using Shiny version 1.9.1 and ShinyJS version 2.1.0.
4