Error in value[[3L]](cond) : app.R did not return a shiny.appobj object.

Hi,

First of all, I have no experience in R. I have to publish an app @ Shiny. Everything goes well until the publishing. It was published but when I try to access I receive the following error:

An error has occurred

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

Error in value[[3L]](cond) : app.R did not return a shiny.appobj object. Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous> Execução interrompida

Any clue?

The app is saved as App.R alone in a directory.

Thanks,

Hi, welcome!

We don't have enough information to help you out, Could you check what your app's logs say?

Thankt for helping me.

Here are the logs:

2019-12-11T14:32:47.315566+00:00 shinyapps[1589304]: Server version: 1.7.8-7
2019-12-11T14:32:47.315601+00:00 shinyapps[1589304]: LANG: pt_BR.UTF-8
2019-12-11T14:32:47.315603+00:00 shinyapps[1589304]: R version: 3.6.1
2019-12-11T14:32:47.315606+00:00 shinyapps[1589304]: shiny version: 1.4.0
2019-12-11T14:32:47.315607+00:00 shinyapps[1589304]: httpuv version: 1.5.2
2019-12-11T14:32:47.315607+00:00 shinyapps[1589304]: rmarkdown version: (none)
2019-12-11T14:32:47.315632+00:00 shinyapps[1589304]: jsonlite version: 1.6
2019-12-11T14:32:47.315631+00:00 shinyapps[1589304]: knitr version: (none)
2019-12-11T14:32:47.315633+00:00 shinyapps[1589304]: RJSONIO version: (none)
2019-12-11T14:32:47.315644+00:00 shinyapps[1589304]: htmltools version: 0.4.0
2019-12-11T14:32:47.485831+00:00 shinyapps[1589304]:
2019-12-11T14:32:47.315820+00:00 shinyapps[1589304]: Using pandoc at /opt/connect/ext/pandoc2
2019-12-11T14:32:47.476126+00:00 shinyapps[1589304]: Using jsonlite for JSON processing
2019-12-11T14:32:47.485833+00:00 shinyapps[1589304]: Starting R with process ID: '27'
2019-12-11T14:32:47.511161+00:00 shinyapps[1589304]: Calls: local ... tryCatch -> tryCatchList -> tryCatchOne ->
2019-12-11T14:32:47.511160+00:00 shinyapps[1589304]: Error in value[3L] : app.R did not return a shiny.appobj object.
2019-12-11T14:32:47.511162+00:00 shinyapps[1589304]: Execução interrompida
2019-12-11T14:32:52.212607+00:00 shinyapps[1589304]: Server version: 1.7.8-7
2019-12-11T14:32:52.212609+00:00 shinyapps[1589304]: LANG: pt_BR.UTF-8
2019-12-11T14:32:52.212638+00:00 shinyapps[1589304]: R version: 3.6.1
2019-12-11T14:32:52.212640+00:00 shinyapps[1589304]: shiny version: 1.4.0
2019-12-11T14:32:52.212641+00:00 shinyapps[1589304]: rmarkdown version: (none)
2019-12-11T14:32:52.212641+00:00 shinyapps[1589304]: knitr version: (none)
2019-12-11T14:32:52.212641+00:00 shinyapps[1589304]: jsonlite version: 1.6
2019-12-11T14:32:52.212660+00:00 shinyapps[1589304]: htmltools version: 0.4.0
2019-12-11T14:32:52.212640+00:00 shinyapps[1589304]: httpuv version: 1.5.2
2019-12-11T14:32:52.212816+00:00 shinyapps[1589304]: Using pandoc at /opt/connect/ext/pandoc2
2019-12-11T14:32:52.212652+00:00 shinyapps[1589304]: RJSONIO version: (none)
2019-12-11T14:32:52.377582+00:00 shinyapps[1589304]: Using jsonlite for JSON processing
2019-12-11T14:32:52.388302+00:00 shinyapps[1589304]:
2019-12-11T14:32:52.388303+00:00 shinyapps[1589304]: Starting R with process ID: '43'
2019-12-11T14:32:52.415932+00:00 shinyapps[1589304]: Calls: local ... tryCatch -> tryCatchList -> tryCatchOne ->
2019-12-11T14:32:52.415931+00:00 shinyapps[1589304]: Error in value[3L] : app.R did not return a shiny.appobj object.
2019-12-11T14:32:52.415968+00:00 shinyapps[1589304]: Execução interrompida

This suggests there is a problem with your code, maybe a syntax error while constructing the ui or server functions. Could you show us your code?

Sure.

First:

install.packages("shiny")
install.packages("rsconnect")
library(shiny)

And then in the App.R script:

# Define a interface do usuário para o app que gera um histograma.
ui <- fluidPage(
  
  # Título do app.
  titlePanel("Meu primeiro Aplicativo Shiny no curso de Especialização em Big Data da Unisinos!"),
  
  # Barra lateral com as definições do input e do output.
  sidebarLayout(
    
    # Barra lateral para os inputs.
    sidebarPanel(
      
      # Input: número de classes do histograma.
      sliderInput(inputId = "classes",
                  label = "Defina o número de classes do histograma:",
                  min = 1,
                  max = 30,
                  value = 10)
      
    ),
    
    # Painel principal para mostrar os outputs.
    mainPanel(
      
      # Output: Histograma
      plotOutput(outputId = "distPlot")
      
    )
  )
)

# Código com a função server:

# Define o código para a construção do histograma.
server <- function(input, output) {
  
  # Função que gera o histograma e devolve para o user side.
  # O histograma vai mudar sempre que o valor do número de classes alterar.
  output$distPlot <- renderPlot({
    
    x    <- iris$Sepal.Length
    bins <- seq(min(x), max(x), length.out = input$classes + 1)
    
    hist(x, breaks = bins, col = "#781E77", border = "white",
         xlab = "Comprimento da Sépala",
         main = "Histograma: comprimento da sépala em centímetros.")
    
  })
  
}

# Código com a chamada para a função shinyApp
shinyApp(ui = ui, server = server)

You have to include library calls (i.e. library(shiny)) in your app.R file, have in mind that the app is going to be executed on a machine other than yours, so the packages you have loaded in your local environment are not going to be available there if you don't explicitly load them.

I just included the library(shiny) in the script. Same error. :frowning:

library(shiny)

# Define a interface do usuário para o app que gera um histograma.
ui <- fluidPage(
  
  # Título do app.
  titlePanel("Meu primeiro Aplicativo Shiny no curso de Especialização em Big Data da Unisinos!"),
  
  # Barra lateral com as definições do input e do output.
  sidebarLayout(
    
    # Barra lateral para os inputs.
    sidebarPanel(
      
      # Input: número de classes do histograma.
      sliderInput(inputId = "classes",
                  label = "Defina o número de classes do histograma:",
                  min = 1,
                  max = 30,
                  value = 10)
      
    ),
    
    # Painel principal para mostrar os outputs.
    mainPanel(
      
      # Output: Histograma
      plotOutput(outputId = "distPlot")
      
    )
  )
)

# Código com a função server:

# Define o código para a construção do histograma.
server <- function(input, output) {
  
  # Função que gera o histograma e devolve para o user side.
  # O histograma vai mudar sempre que o valor do número de classes alterar.
  output$distPlot <- renderPlot({
    
    x    <- iris$Sepal.Length
    bins <- seq(min(x), max(x), length.out = input$classes + 1)
    
    hist(x, breaks = bins, col = "#781E77", border = "white",
         xlab = "Comprimento da Sépala",
         main = "Histograma: comprimento da sépala em centímetros.")
    
  })
  
}

# Código com a chamada para a função shinyApp
shinyApp(ui = ui, server = server)

I can't reproduce your issue, I have copied your exact code and published the app to shinyapps.io and everything works as expected

Try deleting your app in shinyapps.io and redeploying from scratch.

Having the exact same issue, doesn't seem to be a syntax error in my code and have tried deleting and redeploying to no avail

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.