Errors in observeEvent have too much stack trace hidden
Closed this issue · 1 comments
jcheng5 commented
System details
Browser Version:
Output of `sessionInfo()`: NA
─ Session info ──────────────────────────────────────────────────────────────────────────────────
setting value
version R version 4.3.2 (2023-10-31)
os macOS 15.1.1
system aarch64, darwin20
ui RStudio
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz America/Los_Angeles
date 2024-12-09
rstudio 2024.04.2+764 Chocolate Cosmos (desktop)
pandoc 2.19.2 @ /opt/homebrew/bin/pandoc
─ Packages ──────────────────────────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
bslib 0.8.0 2024-07-29 [1] CRAN (R 4.3.3)
cachem 1.1.0 2024-05-16 [1] CRAN (R 4.3.3)
cli 3.6.3 2024-06-21 [1] CRAN (R 4.3.3)
crayon 1.5.3 2024-06-20 [1] CRAN (R 4.3.3)
devtools 2.4.5 2022-10-11 [1] CRAN (R 4.3.0)
digest 0.6.37 2024-08-19 [1] CRAN (R 4.3.3)
ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.3.0)
fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.3.3)
fs 1.6.5 2024-10-30 [1] CRAN (R 4.3.3)
glue 1.8.0 2024-09-30 [1] CRAN (R 4.3.3)
htmltools 0.5.8.9000 2024-07-19 [1] Github (rstudio/htmltools@487aa0b)
htmlwidgets 1.6.4 2023-12-06 [1] CRAN (R 4.3.1)
httpuv 1.6.15 2024-03-26 [1] CRAN (R 4.3.1)
jquerylib 0.1.4 2021-04-26 [1] CRAN (R 4.3.0)
jsonlite 1.8.9 2024-09-20 [1] CRAN (R 4.3.3)
later 1.4.1 2024-11-27 [1] CRAN (R 4.3.3)
lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.3.1)
magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.3.0)
memoise 2.0.1 2021-11-26 [1] CRAN (R 4.3.0)
mime 0.12 2021-09-28 [1] CRAN (R 4.3.0)
miniUI 0.1.1.1 2018-05-18 [1] CRAN (R 4.3.0)
pkgbuild 1.4.4 2024-03-17 [1] CRAN (R 4.3.1)
pkgload 1.4.0 2024-06-28 [1] CRAN (R 4.3.3)
profvis 0.4.0 2024-09-20 [1] CRAN (R 4.3.3)
promises 1.3.2 2024-11-28 [1] CRAN (R 4.3.3)
purrr 1.0.2 2023-08-10 [1] CRAN (R 4.3.0)
R6 2.5.1 2021-08-19 [1] CRAN (R 4.3.0)
Rcpp 1.0.13-1 2024-11-02 [1] CRAN (R 4.3.3)
remotes 2.5.0.9000 2024-04-03 [1] Github (r-lib/remotes@5b7eb08)
rlang 1.1.4 2024-06-04 [1] CRAN (R 4.3.3)
rsconnect 1.3.1 2024-06-04 [1] CRAN (R 4.3.3)
rstudioapi 0.17.0 2024-10-16 [1] CRAN (R 4.3.3)
sass 0.4.9.9000 2024-07-19 [1] Github (rstudio/sass@9228fcf)
sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.0)
shiny * 1.9.1.9000 2024-12-10 [1] local
urlchecker 1.0.1 2021-11-30 [1] CRAN (R 4.3.0)
usethis 3.0.0 2024-07-29 [1] CRAN (R 4.3.3)
vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.3.1)
xtable 1.8-4 2019-04-21 [1] CRAN (R 4.3.0)
[1] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
Example application or steps to reproduce the problem
library(shiny)
ui <- fluidPage()
server <- function(input, output, session) {
observeEvent(TRUE, {
stop("boom")
})
}
shinyApp(ui, server)
Describe the problem in detail
When run, this app immediately errors (as intended). The console looks like this:
Listening on http://127.0.0.1:7821
Warning: Error in observe: boom
4: runApp [/Users/jcheng/Development/rstudio/shiny3/R/runapp.R#388]
3: print.shiny.appobj [/Users/jcheng/Development/rstudio/shiny3/R/shinyapp.R#565]
1: source
Note that no useful information is present about where the error is coming from. If you change observeEvent(TRUE, {
to observe({
, then the useful information appears (the line starting with 52:
):
Listening on http://127.0.0.1:7821
Warning: Error in observe: boom
53: stop
52: observe [~/.active-rstudio-document#7]
51: <observer> [/Users/jcheng/Development/rstudio/shiny3/R/utils.R#1459]
4: runApp [/Users/jcheng/Development/rstudio/shiny3/R/runapp.R#388]
3: print.shiny.appobj [/Users/jcheng/Development/rstudio/shiny3/R/shinyapp.R#565]
1: source
jcheng5 commented
The problem has to do with stack trace stripping; if you set options(shiny.fullstacktrace=TRUE)
you'll see that the info is all there, just getting pruned out in the observeEvent
case because it's missing a ..stacktraceon..
somewhere.