Open renkun-ken opened 7 years ago
Can you give us a minimal reproducible example?
Try options(shiny.fullstacktrace=TRUE)
before running the app and let us know if you get a bigger stack trace.
I notice that if the error is in the server
function, the stack trace is helpful enough to find the errors. Unfortunately, I found that the error was actually in body
which seems to be lazily evaluated till shinyApp
is called. In this case, if I do not force evaluating body
, it will be harder to find where the problem is.
The following is a simple example to reproduce this:
library(shiny)
library(shinydashboard)
header <- dashboardHeader(title = "Dashboard")
config <- list()
sidebar <- dashboardSidebar(
sidebarMenu(
menuItem("Overview", tabName = "overview")
)
)
body <- dashboardBody(tabItems(
tabItem(tabName = "overview",
tabBox(title = "Overview", width = "100%",
tabPanel("Summary", tableOutput(sprintf("table-%s", config$title)))
))))
ui <- dashboardPage(header, sidebar, body)
server <- function(input, output, session) {
output[[sprintf("table-%s", config$title)]] <- renderTable(mtcars)
}
shinyApp(ui, server)
Above, config$title
is exceptionally NULL
but from the error message or stack trace I cannot quickly find it, not until I evaluate body
and see the error:
> body
Error in if (!is.na(attribValue)) { : argument is of length zero
By using options(shiny.fullstacktrace=TRUE)
I get a deeper stacktrace but still I do not see the line number of the errors.
I'm using shiny and shinydashboard which periodically query a mongodb server and present data in the dashboard. The dashboard is highly dynamic since its menu and tab pages are dynamically determined by the config and database entries. The dashboard also uses reactive variables to ensure the data are the latest.
Recently I rewrote a major part of the dashboard and it is broken with an stack trace that cannot be more simplified:
If any line number is provided in the stack trace, it would be much better than having no clue at all.