app.R did not return a shiny.appobj object

...I'm trying to deploy my shiny app on shinyapp.io server. All the data files are in working directory and i've added required libraries in the app.R file. The app runs fine locally but when i run rsconnect::deployApp() command. It gives me this error
Error in value[3L] : app.R did not return a shiny.appobj object.
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne ->
Execution halted

Can you show the code of the app you are trying to deploy?

It is better if you post it here. If you have privacy concerns, then you can post a minimal reproducible example instead. Please have a look at this resources, to see how to create one for a shiny app

library(shinydashboard)

library(plotly)

library(ggplot2)

library(rsconnect)

library(ggraph)

library(igraph)

library(tidyverse)

library(viridisLite)

library(viridis)

library(DT)

library(shiny)

library(plotly)

library(collapsibleTree)

library(dplyr)

library(RODBC)

library(formattable)

library(shinythemes)

library(RCurl)

c<-read.csv("C.csv",stringsAsFactors = F, header=TRUE)


mycolors <- c("blue", "#FFC125", "darkgreen", "darkorange")


if (interactive()) {
    options(device.ask.default = FALSE)
shinyApp(ui=shinyUI(navbarPage(" Dashboard",theme = shinytheme("cerulean"),windowTitle = "ABC",
                tabPanel("Dashboard",
                         (fluidRow(column(width = 5,(plotlyOutput("plot4",height=250)))))))),

#Server.R
server=function(input,output){                                                                                                                       
    output$plot4<-renderPlotly(c %>%
                                   group_by(C.T) %>%
                                   summarise(count = n()) %>%
                                   filter(count>10) %>%
                                   plot_ly(labels = ~c$C.T,
                                           values = ~c$of,
                                           marker = list(colors = mycolors)) %>%
                                   add_pie(hole = 0.0) %>%
                                   layout( title ="CT",
                                           xaxis = list(zeroline = F,
                                                        showline = F,
                                                        showticklabels = F,
                                                        showgrid = F),
                                           yaxis = list(zeroline = F,
                                                        showline = F,
                                                        showticklabels=F,
                                                        showgrid=F)))

})
}

Do not enclose your code on this if statement, the code doesn't run interactively on the shinyapps.io servers.

Removed if(interactive()){} from the code. Still getting the same error

I would try to check on this if you provide a reprex, it is hard to eyeball this without being able to test it myself.

>library(shinydashboard)
>library(plotly)
>library(ggplot2)

>library(rsconnect)

>library(ggraph)

>library(igraph)

>library(tidyverse)

>library(viridisLite)

>library(viridis)

>library(DT)

>library(shiny)

>library(plotly)

>library(collapsibleTree)

>library(dplyr)

>library(RODBC)

>library(formattable)

>library(shinythemes)

>library(RCurl)

>c<-data.frame(x=1:5,y=c("a","b","c","d","e"))
>str(b)
'data.frame':	5 obs. of  2 variables:
 $ x: num  1 2 3 4 5
 $ y: Factor w/ 5 levels "a","b","c","d",..: 1 2 3 4 5

>mycolors <- c("blue", "#FFC125", "darkgreen", "darkorange")
>shinyApp(ui=shinyUI(navbarPage(" Dashboard",theme = shinytheme("cerulean"),windowTitle = "ABC",
                tabPanel("Dashboard",
                         (fluidRow(column(width = 5,(plotlyOutput("plot4",height=250)))))))),
#Server.R
server=function(input,output){                                                                                                                       
    output$plot4<-renderPlotly(c %>%
                                   group_by(y) %>%
                                   summarise(count = n()) %>%
                                   filter(count>10) %>%
                                   plot_ly(labels = ~c$y,
                                           values = ~c$x,
                                           marker = list(colors = mycolors)) %>%
                                   add_pie(hole = 0.0) %>%
                                   layout( title ="CT",
                                           xaxis = list(zeroline = F,
                                                        showline = F,
                                                        showticklabels = F,
                                                        showgrid = F),
                                           yaxis = list(zeroline = F,
                                                        showline = F,
                                                        showticklabels=F,
                                                        showgrid=F))))

I made the minimal edits I could to make a working program from what you provided.

library(shinydashboard)
library(tidyverse)
library(shiny)
library(plotly)
library(shinythemes)

mydf <- data.frame(x = 1:5, y = c("a", "b", "c", "d", "e"))

mycolors <- c("blue", "#FFC125", "darkgreen", "darkorange")

shinyApp(
  ui = shinyUI(navbarPage(" Dashboard",
    theme = shinytheme("cerulean"), windowTitle = "ABC",
    tabPanel(
      "Dashboard",
      (fluidRow(column(width = 5, (plotlyOutput("plot4", height = 250)))))
    )
  )),
  # Server.R
  server = function(input, output) {
    output$plot4 <- renderPlotly({
      plot_ly(
        data = mydf, labels = ~ y,
        values = ~ x,
        marker = list(colors = mycolors)
      ) %>%
        add_pie(hole = 0.0) %>%
        layout(
          title = "CT",
          xaxis = list(
            zeroline = F,
            showline = F,
            showticklabels = F,
            showgrid = F
          ),
          yaxis = list(
            zeroline = F,
            showline = F,
            showticklabels = F,
            showgrid = F
          )
        )
    })
  }
)
1 Like

Thank you so much. It is working now.

2 posts were split to a new topic: How to create collapsible tree graph using D3

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