Shiny app works fine locally, error when publishing to Shiny server

Hi, I'm trying to publish my Shiny app to the shinyapps.io server. The app works fine locally on my computer but when I publish it, the following error message appears. Any ideas on how I can fix this? Thanks a lot.

The application failed to start (exited with code 1).

Error in value[[3L]](cond) : invalid multibyte string at '<a0>class'
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted

Difficult to help without a reprex.

OK sorry, I'm new to this. Below is my code. The data set is obtained from the following link

magic <- read.csv("magic.csv")
library(shiny)
library(rsconnect)
magic$class <- factor(magic$class)
magic <- as.data.frame(magic)

ui <- fluidPage(
  titlePanel("Telescope measurements by class of radiation"),
  sidebarLayout(
    sidebarPanel(
      selectInput(inputId = "p", label = "Select measurement:", 
                             choices = c("fLength" = "fLength",
                                         "fWidth" = "fWidth",
                                         "fSize" = "fSize", 
                                         "fConc" = "fConc", 
                                         "fConc1" = "fConc1", 
                                         "fAsym" = "fAsym", 
                                         "fM3Long" = "fM3Long", 
                                         "fM3Trans" = "fM3Trans", 
                                         "fAlpha" = "fAlpha",
                                         "fDist" = "fDist" )),
                 checkboxInput(inputId = "outliers", 
                               label =  "Show outliers", TRUE),
      checkboxInput(inputId = "notches", label = "Show notches", FALSE)
      
    ),
    mainPanel(
      plotOutput("myplot")
    )
  )
)

server <- function(input, output, session) {
  ghcol <- c("indianred2", "slateblue1")
  output$myplot <- renderPlot({
    boxplot(magic[,input$p]~magic$class,
            names = c("Gamma (Signal)", "Hadron (Background)"), 
            col = ghcol, 
            main = paste(input$p), 
            outline = input$outliers,
            xlab = "Radiation Class",
            cex.axis = 0.9,
            notch = input$notches
    )
  })
}

shinyApp(ui, server)


Did the application fail to deploy, or it deployed and immediately exited giving the grey screen?

What is the output of rsconnect::appDependencies() and sessionInfo()?

1 Like

Hi Josh, I think it does deploy as there is a link to the app on my shiny server account https://dalyoi.shinyapps.io/17116155_project/

If you click that, it just brings up the error I described in the original post.

The outputs are as follows;

> rsconnect::appDependencies()
Error in bundleFiles(appDir) : 
  The directoryC:/Users/oisin/Documentscannot be deployed because it contains too many files (the maximum number of files is 10000). Remove some files or adjust the rsconnect.max.bundle.files option.

> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_Ireland.1252  LC_CTYPE=English_Ireland.1252    LC_MONETARY=English_Ireland.1252
[4] LC_NUMERIC=C                     LC_TIME=English_Ireland.1252    

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] rsconnect_0.8.8    shiny_1.1.0        kernlab_0.9-26     xgboost_0.71.2     adabag_4.2        
 [6] doParallel_1.0.11  iterators_1.0.10   foreach_1.4.4      rpart_4.1-13       fastAdaboost_1.0.0
[11] e1071_1.7-0        ipred_0.9-6        rattle_5.1.0       caTools_1.17.1.1   mboost_2.9-0      
[16] stabs_0.6-3        plyr_1.8.4         ROSE_0.0-3         caret_6.0-80       ggplot2_3.0.0     
[21] lattice_0.20-35   

loaded via a namespace (and not attached):
 [1] nlme_3.1-137       bitops_1.0-6       lubridate_1.7.4    dimRed_0.1.0       tools_3.5.1       
 [6] backports_1.1.2    R6_2.2.2           lazyeval_0.2.1     colorspace_1.3-2   nnet_7.3-12       
[11] withr_2.1.2        tidyselect_0.2.4   compiler_3.5.1     scales_0.5.0       sfsmisc_1.1-2     
[16] DEoptimR_1.0-8     nnls_1.4           mvtnorm_1.0-8      robustbase_0.93-2  quadprog_1.5-5    
[21] stringr_1.3.1      digest_0.6.15      pkgconfig_2.0.1    htmltools_0.3.6    rlang_0.2.1       
[26] ddalpha_1.3.4      bindr_0.1.1        jsonlite_1.5       dplyr_0.7.6        ModelMetrics_1.1.0
[31] RCurl_1.95-4.11    magrittr_1.5       Formula_1.2-3      Matrix_1.2-14      Rcpp_0.12.18      
[36] munsell_0.5.0      abind_1.4-5        partykit_1.2-2     stringi_1.2.4      inum_1.0-0        
[41] RJSONIO_1.3-0      MASS_7.3-50        recipes_0.1.3      grid_3.5.1         pls_2.6-0         
[46] promises_1.0.1     crayon_1.3.4       splines_3.5.1      pillar_1.3.0       reshape2_1.4.3    
[51] codetools_0.2-15   stats4_3.5.1       CVST_0.2-2         magic_1.5-8        glue_1.3.0        
[56] data.table_1.11.4  httpuv_1.4.5       gtable_0.2.0       purrr_0.2.5        tidyr_0.8.1       
[61] assertthat_0.2.0   DRR_0.0.3          gower_0.1.2        mime_0.5           prodlim_2018.04.18
[66] xtable_1.8-2       libcoin_1.0-1      broom_0.5.0        later_0.7.3        class_7.3-14      
[71] survival_2.42-3    geometry_0.3-6     timeDate_3043.102  RcppRoll_0.3.0     tibble_1.4.2      
[76] bindrcpp_0.2.2     lava_1.6.2         RGtk2_2.20.35     

Are you running rsconnect::appDependencies() while your current directory is your application directory? If not, could you? I assume you do not get that error when deploying.

I would suggest ensuring that your files are UTF-8 encoded, as I suspect that is the nature of the error message you are seeing.