Error after deploying to shinyapps.io "Error in is.data.frame: object not found"

For the first time, I'm using shinyapps.io and after I deploy the files via R (app.r, server.R and ui.R), it shows the error below:

And when I see it in the log, I don't know why it's giving the error:

Warning: Error in is.data.frame: object 'dataLog' not found

Log:

2020-06-24T19:21:39.184656+00:00 shinyapps[2463853]: Server version: 1.8.2.1-12
2020-06-24T19:21:39.184724+00:00 shinyapps[2463853]: LANG: pt_BR.UTF-8
2020-06-24T19:21:39.184726+00:00 shinyapps[2463853]: httpuv version: 1.5.4
2020-06-24T19:21:39.184725+00:00 shinyapps[2463853]: R version: 4.0.2
2020-06-24T19:21:39.184726+00:00 shinyapps[2463853]: shiny version: 1.5.0
2020-06-24T19:21:39.184727+00:00 shinyapps[2463853]: rmarkdown version: 2.3
2020-06-24T19:21:39.184728+00:00 shinyapps[2463853]: jsonlite version: 1.6.1
2020-06-24T19:21:39.184728+00:00 shinyapps[2463853]: RJSONIO version: (none)
2020-06-24T19:21:39.386150+00:00 shinyapps[2463853]: Using jsonlite for JSON processing
2020-06-24T19:21:39.184727+00:00 shinyapps[2463853]: knitr version: 1.29
2020-06-24T19:21:39.389651+00:00 shinyapps[2463853]: 
2020-06-24T19:21:39.389652+00:00 shinyapps[2463853]: Starting R with process ID: '25'
2020-06-24T19:21:39.184728+00:00 shinyapps[2463853]: htmltools version: 0.5.0
2020-06-24T19:21:39.184908+00:00 shinyapps[2463853]: Using pandoc: /opt/connect/ext/pandoc2
2020-06-24T19:21:39.441428+00:00 shinyapps[2463853]: 
2020-06-24T19:21:39.441429+00:00 shinyapps[2463853]: Listening on http://127.0.0.1:44640
2020-06-24T19:21:45.759522+00:00 shinyapps[2463853]: 
2020-06-24T19:21:45.759526+00:00 shinyapps[2463853]: Attaching package: ‘timevis’
2020-06-24T19:21:45.760365+00:00 shinyapps[2463853]: The following object is masked from ‘package:shiny’:
2020-06-24T19:21:45.759526+00:00 shinyapps[2463853]: 
2020-06-24T19:21:45.760367+00:00 shinyapps[2463853]: 
2020-06-24T19:21:45.760368+00:00 shinyapps[2463853]:     runExample
2020-06-24T19:21:45.760368+00:00 shinyapps[2463853]: 
2020-06-24T19:21:48.853184+00:00 shinyapps[2463853]: Warning: Error in is.data.frame: objeto 'dataLog' não encontrado
2020-06-24T19:21:48.868144+00:00 shinyapps[2463853]:   111: timevis
2020-06-24T19:21:48.868142+00:00 shinyapps[2463853]:   112: is.data.frame
2020-06-24T19:21:48.868145+00:00 shinyapps[2463853]:   107: func
2020-06-24T19:21:48.868145+00:00 shinyapps[2463853]:    94: origRenderFunc
2020-06-24T19:21:48.868146+00:00 shinyapps[2463853]:    93: output$app1
2020-06-24T19:21:48.868146+00:00 shinyapps[2463853]:    13: runApp
2020-06-24T19:21:48.868146+00:00 shinyapps[2463853]:    12: fn
2020-06-24T19:21:48.868147+00:00 shinyapps[2463853]:     7: connect$retry
2020-06-24T19:21:48.868147+00:00 shinyapps[2463853]:     6: eval
2020-06-24T19:21:48.868147+00:00 shinyapps[2463853]:     5: eval

Because in R it works normally without any errors, including when deploying and when I run the app.

When deploying:

When run app:

We would need to see more code. Like the code for output$app1 and where you have dataLog

@nirgrahamuk Shoul I post app.R code and ui.R code?
It might be a little bit big to post the code here.

you would either need to cut away excess code from app.R and ui.R so as to make a minimal code that still shows the issue. or pick out the relevant parts I asked for (as a first step)

@nirgrahamuk, for output, the ui.R code is below:

source("app.R")
library(shiny)
library(timevis)

# Define UI for application that draws a histogram
shinyUI(fluidPage(
  
  # Adiciona as abas
  navbarPage("Gráficos", 
             
             tabPanel("Gráfico por processo",  
                      
                      sidebarLayout(
                        sidebarPanel(
                          dateInput("date1", "Escolha uma data:", format = "dd/mm/yyyy", language = "pt-BR", width = "150px"),
                          selectInput("select1", "Escolha um processo:", dfLog3$NM_ENVIRONMENT, selected = NULL,  width = "150px"),
                          actionButton(inputId = "go2", label = "Atualizar", icon("refresh"), width = "150px", height = "200"),
                          div(style="display: inline-block;vertical-align:top; width: 200px;",HTML("<br>")),
                          dateRangeInput("daterange1", "Escolha um período:", start = Sys.Date()-1, end = Sys.Date(), format = "dd/mm/yy", separator = " - ", width = "170px", language = "pt-BR"),
                          width = 2),
                        mainPanel(timevisOutput("app1"), width = 10)
                      )),
             
             tabPanel("Gráfico por sistema",
                      
                      sidebarLayout(
                        sidebarPanel(
                          dateInput("date1", "Escolha uma data:", format = "dd/mm/yyyy", language = "pt-BR", width = "150px"),
                          selectInput("select1", "Escolha um sistema/área:", dfLog4$NM_SYSTEM, selected = NULL,  width = "150px"),
                          actionButton(inputId = "go2", label = "Atualizar", icon("refresh"), width = "150px", height = "200"),
                          div(style="display: inline-block;vertical-align:top; width: 200px;",HTML("<br>")),
                          dateRangeInput("daterange1", "Escolha um período:", start = Sys.Date()-1, end = Sys.Date(), format = "dd/mm/yy", separator = " - ", width = "170px", language = "pt-BR"),
                          width = 2),
                        mainPanel(timevisOutput("app2"), width = 10)
                      )),
             
             tabPanel("Gráfico por data",
                      
                      sidebarLayout(
                        sidebarPanel(
                          dateInput("date1", "Escolha uma data:", format = "dd/mm/yyyy", language = "pt-BR", width = "150px"),
                          dateRangeInput("daterange1", "Escolha um período:", start = Sys.Date()-1, end = Sys.Date(), format = "dd/mm/yy", separator = " - ", width = "170px", language = "pt-BR"),
                          width = 2),
                        mainPanel(timevisOutput("app4"), width = 10)
                      )),
             
             tabPanel("Gráfico por eventos individuais",
                      
                      timevisOutput("app3"))
  )
))

For the server.R the code is below:

library(timevis)
library(shiny)
source("app.R")

# Define server logic required to draw a histogram
shinyServer(function(input, output) {

    output$app1 <- renderTimevis(timevis(dataLog, 
                                         distinct(dataLogGroups), 
                                         showZoom = TRUE, 
                                         options = list(orientation = 'top', showCurrentTime = TRUE),
                                         height = 700
    ) %>% setWindow(Sys.Date() - 1,Sys.Date() + 1))
    
    output$app2 <- renderTimevis(timevis(dataLog2, 
                                         distinct(dataLogGroups2), 
                                         showZoom = TRUE, 
                                         options = list(orientation = 'top', showCurrentTime = TRUE),
                                         height = 700
    ) %>% setWindow(Sys.Date() - 1,Sys.Date() + 1))
    
    output$app3 <- renderTimevis(timevis(dataLog3, 
                                         showZoom = TRUE, 
                                         options = list(orientation = 'top', showCurrentTime = TRUE),
                                         height = 700
    ) %>% setWindow(Sys.Date() - 1,Sys.Date() + 1))
    
    output$app4 <- renderTimevis(timevis(dataLog4, 
                                         showZoom = TRUE, 
                                         options = list(orientation = 'top', showCurrentTime = TRUE),
                                         height = 700
    ) %>% setWindow(Sys.Date() - 1,Sys.Date() + 1))

})

For the datalog, the app.R code is below (but the steps to get and transform the dataframe I didn't not paste here):

dataLog <- data.frame(
  title = paste("Processo:", c(dfLog3$NM_ENVIRONMENT), sep = " "),
  content = c(TemplateProcesso(strftime(dfLog3$DT_TIMESTART, format="%H:%M:%S"), strftime(dfLog3$DT_TIMEEND, format="%H:%M:%S"), dfLog3$QT_PROCEDURE, seconds_to_period((dfLog3$DT_TIMEEND - dfLog3$DT_TIMESTART)), seconds_to_period(dfLog3$QT_TIMESECS))),
  start = c(dfLog3$DT_TIMESTART),
  end = c(dfLog3$DT_TIMEEND),
  #style = c(TemplateCores(nrow(table(dfLog3$NM_ENVIRONMENT)))),
  group = c(dfLog3$ID_ENVIRONMENT))


dataLogGroups <- data.frame(
  id = c(dfLog3$ID_ENVIRONMENT), 
  content = c(dfLog3$NM_ENVIRONMENT),
  style = "font-weight: bold")

timevis(dataLog,distinct(dataLogGroups),showZoom = TRUE,options = list(orientation = 'top')) %>%
  setWindow(Sys.Date() - 1,Sys.Date() + 1) %>%
  addCustomTime(Sys.Date() - 1, "yesterday")

no obvious problems though you are using an old-fashioned approach to instantiating shiny apps shinyUI() etc.

for simplicity, why not start a clean 1 code app with the modern template ( call this app.R)

library(shiny)

ui <- fluidPage(
  
)

server <- function(input, output, session) {
  
}

shinyApp(ui, server)

to start with limit yourself to what you need for app1 only, you have app2 and app3 and so many things in your reprex...

@nirgrahamuk Since it's my first shiny app, I followed the shinny tutorial to build, that's why I have in 3 different files. And with that, I think it can be easier to understand (I guess). But why it gives me that error?

Error in is.data.frame: object 'dataLog' not found

it gives you that error because the object can't be found. I would guess in the UI specifically
maybe try putting it into global.R
https://shiny.rstudio.com/articles/scoping.html