Issue with shiny app deployment

Hello everyone, I hope someone can help me solve a problem that has given me a lot of headaches and I thank you for that. I've been trying to publish a Shiny app. The app works fine when run locally but every time I do it it throws the following error:

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

I don't know what is happening, since all the files such as the databases are inside the app directory
If anyone could help me figure it out, I'd really appreciate it. I'm a little desperate

The following is the app code:

library(shiny)
library(readxl)
library(zoo)
library(bs4Dash)
library(echarts4r)
library(dplyr)
# datos
baseCFE <- read_excel("baseCFE.xlsx")
baseCFE <- baseCFE %>% 
    mutate(med_movil = rollmean(Close, k =12, fill = NA))



## app
if (interactive()) {
    
    shiny::shinyApp(
        ui = bs4DashPage(
            enable_preloader = TRUE,
            sidebar_collapsed = TRUE,
            navbar = dashboardHeader(
                controlbarIcon = "th",
                rightUi = bs4UserMenu(
                    name = "Jorge Hernández",
                    status = "primary",
                    src = "https://scontent.fmex11-3.fna.fbcdn.net/v/t1.18169-9/15977305_1321122747949784_7334372997479118351_n.jpg?_nc_cat=104&ccb=1-3&_nc_sid=174925&_nc_ohc=X8TgIg_Mu1QAX-HqPqU&_nc_ht=scontent.fmex11-3.fna&oh=a8af6fd6fe230deb1397a4c5f0b76274&oe=609DBE89", 
                    title = "Economista",
                    subtitle = "Trainee",
                    footer = p("Tenaris Tamsa", class = "text-center"),
                    "Análisis económico."
                ) ),
            sidebar = bs4DashSidebar(
                bs4SidebarUserPanel(
                    img = "https://pbs.twimg.com/profile_images/1111702613102219264/eRTn09Jm_400x400.jpg",
                    text = "Análisis económico"
                ),
                bs4SidebarMenu(
                    bs4SidebarHeader("INEGI"),
                    bs4SidebarMenuItem(
                        text = "Indicadores generales",
                        icon = "fas fa-chart-line",
                        startExpanded = TRUE,
                        bs4SidebarMenuSubItem(
                            text = "Construcción", tabName = "construc", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "Energía", tabName = "energia", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "Minería", tabName = "miner", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "Manufacturas", tabName = "manufac", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "Consumo privado", tabName = "consumo", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "Desempleo", tabName = "desempleo", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "IGAE", tabName = "igae", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "Inflación", tabName = "inflacion", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "Inversión fija bruta", tabName = "invfija", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "Personal (Manufacturas)", tabName = "personalmanufac", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "PIB", tabName = "pib", icon = "fas fa-tasks"
                        )
                    ),
                    bs4SidebarHeader("Seguimiento a PEMEX y CFE"),
                    bs4SidebarMenuItem(
                        text = "PEMEX y CFE",
                        icon = "fa fa-gas-pump",
                        startExpanded = TRUE,
                        bs4SidebarMenuSubItem(
                            text = "PEMEX", tabName = "pemex", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "CFE", tabName = "cfe", icon = "fas fa-tasks"
                        )
                    ),
                    bs4SidebarHeader("BANXICO"),
                    bs4SidebarMenuItem(
                        text = "Comercio exterior",
                        icon = "fas fa-globe",
                        startExpanded = TRUE,
                        bs4SidebarMenuSubItem(
                            text = "Importaciones", tabName = "importaciones", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "Exportaciones", tabName = "exportaciones", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "Masa monetaria", tabName = "masamon", icon = "fas fa-tasks"
                        )
                    ),
                    bs4SidebarHeader("SHCP"),
                    bs4SidebarMenuItem(
                        text = "Finanzas públicas",
                        icon = "fas fa-balance-scale-left",
                        bs4SidebarMenuSubItem(
                            text = "Ingresos totales", tabName = "ingtotales", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "Ingresos por PEMEX", tabName = "ingpemex", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "Ingresos por CFE", tabName = "ingcfe", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "Gasto programable", tabName = "gastoprog", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "Gasto no programable", tabName = "gastonprog", icon = "fas fa-tasks"
                        )
                  
                    ),
                    bs4SidebarHeader("Seguimiento a tasas y bonos"),
                    bs4SidebarMenuItem(
                        text = "Tasas y bonos",
                        icon = "fas fa-coins",
                        startExpanded = FALSE,
                        active = TRUE,
                        bs4SidebarMenuSubItem(
                            text = "Tenencia de bonos", tabName = "tenenciabonos", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "Tasa de referencia", tabName = "tasaref", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "TIIE", tabName = "tiie", icon = "fas fa-tasks"
                        )  
                        ),
                    bs4SidebarHeader("Datos geográficos"),
                    bs4SidebarMenuItem(
                        text = "Mapas económicos",
                        icon = "fas fa-globe-americas",
                        startExpanded = FALSE,
                        active = TRUE,
                        bs4SidebarMenuSubItem(
                            text = "Acero en el mundo", tabName = "acero", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "Riesgo país", tabName = "riesgopais", icon = "fas fa-tasks"
                        ),
                        bs4SidebarMenuSubItem(
                            text = "Crecimiento del PIB", tabName = "crecimientopais", icon = "fas fa-tasks"
                        )  
                    )
                ) ),
            
            footer = bs4DashFooter(),
            title = "Ejemplo",
            body = bs4DashBody(
                
                bs4TabItems(
                    
                    bs4TabItem(
                        tabName = "item1",
                        bs4Card(
                            title = "Card 1",
                            closable = TRUE,
                            width = 6,
                            solidHeader = TRUE,
                            status = "primary",
                            collapsible = TRUE,
                            p("Box Content")
                        ) ),
                    bs4TabItem(
                        tabName = "item2",
                        bs4Card(
                            title = "Card 2",
                            closable = TRUE,
                            width = 6,
                            solidHeader = TRUE,
                            status = "warning",
                            collapsible = TRUE,
                            p("Box Content")
                        )
                    ),
                    bs4TabItem(
                        tabName = "item2",
                        bs4Card(
                            title = "Card 2",
                            closable = TRUE,
                            width = 6,
                            solidHeader = TRUE,
                            status = "warning",
                            collapsible = TRUE,
                            p("Box Content")
                        )
                    ),
                    bs4TabItem(
                        tabName = "perro",
                        bs4Card(
                            title = "Card 10",
                            closable = TRUE,
                            width = 6,
                            solidHeader = TRUE,
                            status = "warning",
                            collapsible = TRUE,
                            p("Box Content")
                        )
                    ),
                    bs4TabItem(
                        tabName = "item3",
                        bs4Card(
                            title = "Card 3",
                            closable = TRUE,
                            width = 6,
                            solidHeader = TRUE,
                            status = "danger",
                            collapsible = TRUE,
                            p("Haumea, designado por elen e Brown del ")
                        ) ),
                    bs4TabItem(
                        tabName = "cfe",
                        fluidRow(
                            column(
                                width = 12,
                        bs4Card(
                            title = "Card 4",
                            closable = TRUE,
                            width = 12,
                            solidHeader = TRUE,
                            status = "info",
                            collapsible = TRUE,
                            maximizable = TRUE,
                            p(baseCFE %>% 
                                  echarts4r::e_charts(Fecha) %>% 
                                  e_line(Close, name = "Precio al cierre") %>% 
                                  e_line(med_movil, name = "Media movil") %>% 
                                  e_tooltip(trigger = "axis") %>% 
                                  e_toolbox_feature(feature = "dataZoom") %>% 
                                  e_datazoom() %>% 
                                  e_theme("chalk") %>% 
                                  e_color(color = c("#d94545", "#3281a8")) %>% 
                                  e_title("Gas natural", "Precio al cierre") %>% 
                                  e_toolbox_feature(feature = "saveAsImage"))
                        )),
                        column(
                            width = 12,
                            
                        bs4Card(title = "Card 4",
                                closable = TRUE,
                                width = 12,
                                solidHeader = TRUE,
                                status = "info",
                                collapsible = TRUE,
                                maximizable = TRUE,
                            p (baseCFE %>% 
                                    echarts4r::e_charts(Fecha) %>% 
                                    e_line(Close, name = "Precio al cierre") %>% 
                                    e_line(med_movil, name = "Media movil") %>% 
                                    e_tooltip(trigger = "axis") %>% 
                                    e_toolbox_feature(feature = "dataZoom") %>% 
                                    e_datazoom() %>% 
                                    e_theme("chalk") %>% 
                                    e_color(color = c("#d94545", "#3281a8")) %>% 
                                    e_title("Gas natural", "Precio al cierre") %>% 
                                    e_toolbox_feature(feature = "saveAsImage") %>% 
                                   e_toolbox_feature(feature = "dataView"))
                        )),
                        column(
                            width = 12,
                            
                            bs4Card(title = "Card 4",
                                    closable = TRUE,
                                    width = 12,
                                    solidHeader = TRUE,
                                    status = "info",
                                    collapsible = TRUE,
                                    maximizable = TRUE,
                                    p (baseCFE %>% 
                                           echarts4r::e_charts(Fecha) %>% 
                                           e_line(Close, name = "Precio al cierre") %>% 
                                           e_line(med_movil, name = "Media movil") %>% 
                                           e_tooltip(trigger = "axis") %>% 
                                           e_toolbox_feature(feature = "dataZoom") %>% 
                                           e_datazoom() %>% 
                                           e_theme("chalk") %>% 
                                           e_color(color = c("#d94545", "#3281a8")) %>% 
                                           e_title("Gas natural", "Precio al cierre") %>% 
                                           e_toolbox_feature(feature = "saveAsImage") %>% 
                                           e_toolbox_feature(feature = "dataView"))
                            )))),
                    bs4TabItem(
                        width = 20,
                        tabName = "item5",
                        bs4TabCard(
                            id = "tabcard",
                            title = "A card with tabs",
                            bs4TabPanel(
                                tabName = "Tab 1", 
                                active = FALSE,
                                "Content 1"
                            ),
                            bs4TabPanel(
                                tabName = "Tab 2", 
                                active = TRUE,
                                "Content 2"
                            ),
                            bs4TabPanel(
                                tabName = "Tab 3", 
                                active = FALSE,
                                p("xd")
                            )
                        )
                        )
                ) )
        ),
        server = function(input, output) {}
    )
}







The code doesn't get executed interactively in shinyapps.io servers so this condition is always FALSE and your code does effectively nothing. Do not enclose your code in this if() condition.

I delete the condition, but the the problem doesn't go away, the following screen appears:

Btw, thanks for help me