Shiny app work locally but not in the browers

Hi, everybody,
I'm new to this community.

I've already developed a shiny app (https://agronomofiorentini.shinyapps.io/smart_farming_app_en/), but I'd like to give it a major upgrade, i.e. I'd like to use RData file which contains pre-trained ML templates to be able to predict.

Locally my shinyapp works great, and also the server upload works great without any markers or errors.

But the moment it is online it disconnects me from the server
(https://agronomofiorentini.shinyapps.io/smart_farming_app_upgrade/)

You help me solve this problem.
Thank you
I will post my entire Rcode

library(shiny)
library(shinydashboard)
library(leaflet)
library(leaflet.extras)
library(mapview)
library(raster)
library(rsconnect)
library(FRK)
library(sp)
library(rgdal)
library(sf)
library(pdfCluster)
library(grDevices)
library(RStoolbox)
library(NbClust)
library(stats)
library(CORElearn)

ui <- dashboardPage(skin = "red",
                    dashboardHeader(title = "Smart Farming App", titleWidth = 350,
                                    dropdownMenu(type = "tasks",
                                                 messageItem(
                                                     from = "First step",
                                                     message = "Indicate the field to analyze",
                                                     icon = icon("dice-one")),
                                                 messageItem(
                                                     from = "Secondo step",
                                                     message = "Improve the area with the edit layer tool",
                                                     icon = icon("dice-two")),
                                                 messageItem(
                                                     from = "Terzo step",
                                                     message = "Display the desired vegetation index",
                                                     icon = icon("dice-three")),
                                                 messageItem(
                                                     from = "Quarto step",
                                                     message = "Visualize the prescription map",
                                                     icon = icon("dice-four"))),
                                    
                                    dropdownMenu(type = "notification",
                                                 badgeStatus = "warning",
                                                 notificationItem(icon = icon("users"), 
                                                                  status = "info", 
                                                                  text = "User guide", 
                                                                  href = "https://www.agronomofiorentini.it/smart-farming-app-english-version/"))),
                    dashboardSidebar(width = 350,
                                     sidebarMenu(
                                         menuItem(
                                             "Where is your farm?",
                                             tabName = "shape",
                                             icon = icon("map")),
                                         menuItem(
                                             "Vegetation index",
                                             tabName = "vegetation_index",
                                             icon = icon("layer-group"),
                                             menuSubItem("ARVI", tabName = "ARVI", icon = icon("map")),
                                             menuSubItem("EVI", tabName = "EVI", icon = icon("map")),
                                             menuSubItem("EVI2", tabName = "EVI2", icon = icon("map")),
                                             menuSubItem("GARI", tabName = "GARI", icon = icon("map")),
                                             menuSubItem("GCI", tabName = "GCI", icon = icon("map")),
                                             menuSubItem("GDVI", tabName = "GDVI", icon = icon("map")),
                                             menuSubItem("GIT3", tabName = "GIT3", icon = icon("map")),
                                             menuSubItem("GNDVI", tabName = "GNDVI", icon = icon("map")),
                                             menuSubItem("GOSAVI", tabName = "GOSAVI", icon = icon("map")),
                                             menuSubItem("GRVI", tabName = "GRVI", icon = icon("map")),
                                             menuSubItem("GSAVI", tabName = "GSAVI", icon = icon("map")),
                                             menuSubItem("IPVI", tabName = "IPVI", icon = icon("map")),
                                             menuSubItem("MSAVI2", tabName = "MSAVI2", icon = icon("map")),
                                             menuSubItem("MSR", tabName = "MSR", icon = icon("map")),
                                             menuSubItem("NDVI", tabName = "NDVI", icon = icon("map")),
                                             menuSubItem("NNIR", tabName = "NNIR", icon = icon("map")),
                                             menuSubItem("OSAVI", tabName = "OSAVI", icon = icon("map")),
                                             menuSubItem("SAVI", tabName = "SAVI", icon = icon("map")),
                                             menuSubItem("TDVI", tabName = "TDVI", icon = icon("map")),
                                             menuSubItem("VDVI", tabName = "VDVI", icon = icon("map")),
                                             menuSubItem("WDRVI", tabName = "WDRVI", icon = icon("map"))),
                                         menuItem("Machine Learning - Only for Durum Wheat", tabName = "ML", icon = icon("layer-group"),
                                                  menuSubItem("Nitrogen Nutrition Index", tabName = "NNI", icon = icon("map")),
                                                  menuSubItem("Chlorophyll", tabName = "Clorofilla", icon = icon("map")),
                                                  menuSubItem("Grams of nitrogen per meter square", tabName = "gr_N_m2", icon = icon("map")),
                                                  menuSubItem("Grams of dry matter per meter square", tabName = "peso_secco_g_m2", icon = icon("map"))),
                                         menuItem("Prescription map", tabName = "precription_map", icon = icon("map")))),
                    dashboardBody(
                        tabItems(
                            tabItem(tabName = "shape",
                                    leafletOutput(outputId = "mymap", height = 650)),
                            
                            tabItem(tabName = "NDVI",
                                    mapviewOutput(outputId = "NDVI", height = 650)),
                            
                            tabItem(tabName = "EVI2",
                                    mapviewOutput(outputId = "EVI2", height = 650)),
                            
                            tabItem(tabName = "MSAVI2",
                                    mapviewOutput(outputId = "MSAVI2", height = 650)),
                            
                            tabItem(tabName = "IPVI",
                                    mapviewOutput(outputId = "IPVI", height = 650)),
                            
                            tabItem(tabName = "MSR",
                                    mapviewOutput(outputId = "MSR", height = 650)),
                            
                            tabItem(tabName = "OSAVI",
                                    mapviewOutput(outputId = "OSAVI", height = 650)),
                            
                            tabItem(tabName = "SAVI",
                                    mapviewOutput(outputId = "SAVI", height = 650)),
                            
                            tabItem(tabName = "TDVI",
                                    mapviewOutput(outputId = "TDVI", height = 650)),
                            
                            tabItem(tabName = "GARI",
                                    mapviewOutput(outputId = "GARI", height = 650)),
                            
                            tabItem(tabName = "ARVI",
                                    mapviewOutput(outputId = "ARVI", height = 650)),
                            
                            tabItem(tabName = "EVI",
                                    mapviewOutput(outputId = "EVI", height = 650)),
                            
                            tabItem(tabName = "GCI",
                                    mapviewOutput(outputId = "GCI", height = 650)),
                            
                            tabItem(tabName = "GDVI",
                                    mapviewOutput(outputId = "GDVI", height = 650)),
                            
                            tabItem(tabName = "GIT3",
                                    mapviewOutput(outputId = "GIT3", height = 650)),
                            
                            tabItem(tabName = "GNDVI",
                                    mapviewOutput(outputId = "GNDVI", height = 650)),
                            
                            tabItem(tabName = "GOSAVI",
                                    mapviewOutput(outputId = "GOSAVI", height = 650)),
                            
                            tabItem(tabName = "GRVI",
                                    mapviewOutput(outputId = "GRVI", height = 650)),
                            
                            tabItem(tabName = "NNIR",
                                    mapviewOutput(outputId = "NNIR", height = 650)),
                            
                            tabItem(tabName = "GSAVI",
                                    mapviewOutput(outputId = "GSAVI", height = 650)),
                            
                            tabItem(tabName = "VDVI",
                                    mapviewOutput(outputId = "VDVI", height = 650)),
                            
                            tabItem(tabName = "WDRVI",
                                    mapviewOutput(outputId = "WDRVI", height = 650)),
                            
                            tabItem(tabName = "NNI",
                                    mapviewOutput(outputId = "NNI", height = 650)),
                            
                            tabItem(tabName = "Clorofilla",
                                    mapviewOutput(outputId = "Clorofilla", height = 650)),
                            
                            tabItem(tabName = "gr_N_m2",
                                    mapviewOutput(outputId = "gr_N_m2", height = 650)),
                            
                            tabItem(tabName = "peso_secco_g_m2",
                                    mapviewOutput(outputId = "peso_secco_g_m2", height = 650)),
                            
                            tabItem(
                                tabName = "precription_map",
                                mapviewOutput(outputId = "zone_map_prescription", height = 650)
                            )
                        )
                    )
)

server <- function(input, output, session) {
    
    load("data/ML_models_new.RData")
    blue<-raster("data/blue_regione_marche.tif")
    green<-raster("data/green_regione_marche.tif")
    red<-raster("data/red_regione_marche.tif")
    nir<-raster("data/nir_regione_marche.tif")
    marche<-readOGR(dsn = "data/Marche_shape_a", layer = "Limiti_regionale_Marche")
    marche <- spTransform(marche, CRS("+proj=longlat +datum=WGS84"))
    
    output$mymap <- renderLeaflet({
        
        leaflet(marche) %>%
            
            addPolylines(color = "red") %>%
            
            addProviderTiles(providers$CartoDB.DarkMatter, options = tileOptions(minZoom = 2, maxZoom = 12)) %>%
            
            addProviderTiles(providers$OpenStreetMap, options = tileOptions(minZoom = 12, maxZoom = 15)) %>%
            
            addProviderTiles(providers$Esri.WorldImagery,
                             options = tileOptions(minZoom = 15, maxZoom = 20),
                             group = "Esri.WorldImagery") %>%
            
            addDrawToolbar(
                targetGroup='drawPoly',
                polylineOptions = F,
                circleOptions = F,
                markerOptions = F,
                circleMarkerOptions = F,
                rectangleOptions = F,
                singleFeature = TRUE,
                editOptions = editToolbarOptions(selectedPathOptions = selectedPathOptions())) %>%
            
            addLayersControl(overlayGroups = c('Multispectral images updated to: 08-04-2020'), 
                             options = layersControlOptions(collapsed=FALSE)) %>%
            
            addMeasure(primaryLengthUnit = "meters",
                       primaryAreaUnit = "hectares",
                       position = "topleft",
                       activeColor = "red",
                       completedColor = "red",
                       localization = "en") %>%
            
            addControlGPS(options = gpsOptions(position = "topleft", 
                                               activate = TRUE,
                                               autoCenter = TRUE, 
                                               maxZoom = 5,
                                               setView = TRUE))
    })
    
    observeEvent(input$mymap_draw_new_feature,{
        feature <- input$mymap_draw_new_feature
        progress <- shiny::Progress$new()
        progress$set(message = "WORKING IN PROGRESS")
        df<-as.data.frame(feature$geometry$coordinates)
        df<-as.data.frame(matrix(unlist(df, use.names=FALSE),ncol=2, byrow=TRUE))
        names(df)[names(df) == "V1"] <- "x"
        names(df)[names(df) == "V2"] <- "y"
        df$ID<-1
        pols <- df_to_SpatialPolygons(df, "ID", c("x","y"), CRS("+proj=longlat +datum=WGS84"))
        pols <- spTransform(pols, CRS("+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0"))
        
        clip<-function(raster,shape) {
            a1_crop<-crop(raster,shape)
            step1<-rasterize(shape,a1_crop)
            a1_crop*step1}
        
        blue<-clip(blue, pols)
        green<-clip(green, pols)
        red<-clip(red, pols)
        nir<-clip(nir, pols)
        
        NDVI <- ((nir-red)/(nir+red))
        EVI2 <- 2.5*((nir-red)/(nir+(2.4*red)+1))
        MSAVI2 <- (((2*nir)+1) - (sqrt((((2*nir)+1)^2)-(8*(nir-red)))))/2
        IPVI <- nir/(nir+red)
        MSR <- (((nir/red)-1)/(sqrt(nir/red))+1)
        OSAVI <- ((nir-red)/(nir+red+0.16))
        SAVI <- (1.5*(nir-red))/(nir+red+0.5)
        TDVI <- 1.5*(((nir-red)/(sqrt((nir^2)+red+0.5))))
        GARI <- ((nir-(green-(1.7*(blue-red))))/(nir+(green-(1.7*(blue-red)))))
        ARVI <- ((nir-(red-(blue-red)))/(nir+(red-(blue-red))))
        EVI <- ((nir-red)/(nir+(6*red))-(7.5*blue)+1)
        GCI <- ((nir/green)-1)
        GDVI <- nir-green
        GIT3 <- ((nir-blue)/(green-blue)-1)
        GNDVI <- ((nir-green)/(nir+green))
        GOSAVI <- ((nir-green)/(nir+green+0.16))
        GRVI <- nir/green
        NNIR <- nir/(nir+red+green)
        GSAVI <- 1.5*((nir-green)/(nir+green+0.5))
        VDVI <- ((2*green)-red-blue)/((2*green)+red+blue)
        WDRVI <- ((0.2*nir)-red)/((0.2*nir)+red)
        
        brick<-brick(ARVI, GARI, GNDVI, GOSAVI, IPVI, NNIR)
        names(brick)=c("ARVI", "GARI", "GNDVI", "GOSAVI", "IPVI", "NNIR")
        
        xy<-coordinates(brick)
        
        brick_a<-as.data.frame(brick)
        brick_a <- data.frame(xy, brick_a)
        brick_a<-na.omit(brick_a)
        
        brick_for_prediction<-brick_a[, -1]
        brick_for_prediction<-brick_a[, -1]
        
        NNI<-as.data.frame(predict(gbm_NNI, brick_for_prediction))
        Clorofilla<-as.data.frame(predict(gbm_Clorofilla, brick_for_prediction))
        gr_N_m2<-as.data.frame(predict(gbm_gr_N_m2, brick_for_prediction))
        peso_secco_g_m2<-as.data.frame(predict(gbm_peso_secco_g_m2, brick_for_prediction))
        
        NNI$x<-brick_a$x
        NNI$y<-brick_a$y
        coordinates(NNI) <- ~x+y 
        gridded(NNI) <- TRUE
        
        Clorofilla$x<-brick_a$x
        Clorofilla$y<-brick_a$y
        coordinates(Clorofilla) <- ~x+y 
        gridded(Clorofilla) <- TRUE
        
        gr_N_m2$x<-brick_a$x
        gr_N_m2$y<-brick_a$y
        coordinates(gr_N_m2) <- ~x+y 
        gridded(gr_N_m2) <- TRUE
        
        peso_secco_g_m2$x<-brick_a$x
        peso_secco_g_m2$y<-brick_a$y
        coordinates(peso_secco_g_m2) <- ~x+y 
        gridded(peso_secco_g_m2) <- TRUE
        
        NNI <- raster(NNI)
        Clorofilla <- raster(Clorofilla)
        gr_N_m2 <- raster(gr_N_m2)
        peso_secco_g_m2 <- raster(peso_secco_g_m2)
        
        crs(NNI) <- "+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0"
        crs(Clorofilla) <- "+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0"
        crs(gr_N_m2) <- "+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0"
        crs(peso_secco_g_m2) <- "+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0"
        
        RdYlGr = colorRampPalette(c('Red', 'Yellow', "Green"))
        
        output$NDVI<-renderMapview({
            mapview(NDVI, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$EVI2<-renderMapview({
            mapview(EVI2, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$MSAVI2<-renderMapview({
            mapview(MSAVI2, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$IPVI<-renderMapview({
            mapview(IPVI, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$MSR<-renderMapview({
            mapview(MSR, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$OSAVI<-renderMapview({
            mapview(OSAVI, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$SAVI<-renderMapview({
            mapview(SAVI, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$TDVI<-renderMapview({
            mapview(TDVI, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$GARI<-renderMapview({
            mapview(GARI, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$ARVI<-renderMapview({
            mapview(ARVI, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$EVI<-renderMapview({
            mapview(EVI, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$GCI<-renderMapview({
            mapview(GCI, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$GDVI<-renderMapview({
            mapview(GDVI, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$GIT3<-renderMapview({
            mapview(GIT3, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$GNDVI<-renderMapview({
            mapview(GNDVI, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$GOSAVI<-renderMapview({
            mapview(GOSAVI, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$GRVI<-renderMapview({
            mapview(GRVI, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$NNIR<-renderMapview({
            mapview(NNIR, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$GSAVI<-renderMapview({
            mapview(GSAVI, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$VDVI<-renderMapview({
            mapview(VDVI, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$WDRVI<-renderMapview({
            mapview(WDRVI, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$NNI<-renderMapview({
            mapview(NNI, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$Clorofilla<-renderMapview({
            mapview(Clorofilla, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$gr_N_m2<-renderMapview({
            mapview(gr_N_m2, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        output$peso_secco_g_m2<-renderMapview({
            mapview(peso_secco_g_m2, map.types = c("Esri.WorldImagery"), col.regions=RdYlGr)
        })
        
        pca<-rasterPCA(brick, spca=TRUE)
        NDVI_a<-pca$map$PC1
        NDVI_ZM <- rasterToPoints(NDVI_a, spatial=TRUE)
        NDVI_ZM<-as.data.frame(NDVI_ZM)
        zone <- pdfCluster(NDVI_ZM$PC1)
        zone <- as.data.frame(zone@clusters)
        xy <- as.data.frame(coordinates(NDVI_ZM))
        ZMmap_d <- data.frame(zone, xy)
        ZMmap_a <- st_as_sf(x = ZMmap_d, coords = c("x", "y"), crs = "+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0")
        coordinates(ZMmap_d) <- ~ x + y
        crs.geo <- CRS("+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0")
        proj4string(ZMmap_d) <- crs.geo
        gridded(ZMmap_d) <- TRUE
        ZMmap_b <- raster(ZMmap_d)
        Zone_management<-rasterToPolygons(ZMmap_b)
        
        output$zone_map_prescription<-renderMapview({
            mapview(Zone_management, map.types = c("Esri.WorldImagery"))
        })
        
        on.exit(progress$close())
    })
}

shinyApp(ui = ui, server = server)

we don't have your data so can't run your code to debug.
also, your app is large and complex, so its asking a lot to understand...
Recommend you look at the logs to identify runtime error on your hosted app.
in your console...

rsconnect::showLogs(appName="smart_farming_app_upgrade",streaming=TRUE)
1 Like

Now i get the follow log, i think i get the problem.
the machine lerning models that I pre-trained were built with packages that I didn't put in the shiny app
I will try to fix this problem and let's see what will happen

2020-04-21T14:12:00.497531+00:00 shinyapps[2156953]: Warning: Error in : package gbm is required
2020-04-21T14:12:00.502988+00:00 shinyapps[2156953]:   91: stop
2020-04-21T14:12:00.502991+00:00 shinyapps[2156953]:   90: requireNamespaceQuietStop
2020-04-21T14:12:00.502992+00:00 shinyapps[2156953]:   88: predict.train
2020-04-21T14:12:00.502993+00:00 shinyapps[2156953]:   84: observeEventHandler [/srv/connect/apps/smart_farming_app_upgrade/app.R#275]
2020-04-21T14:12:00.502993+00:00 shinyapps[2156953]:   13: runApp
2020-04-21T14:12:00.502994+00:00 shinyapps[2156953]:    7: connect$retry
2020-04-21T14:12:00.502994+00:00 shinyapps[2156953]:   12: fn
2020-04-21T14:12:00.502994+00:00 shinyapps[2156953]:    6: eval
2020-04-21T14:12:00.502995+00:00 shinyapps[2156953]:    5: eval

Hi @nirgrahamuk

I hope this is what you asked for to help me solve this problem.

2020-04-21T13:41:35.053533+00:00 shinyapps[2156953]: pdfCluster 1.0-3
2020-04-21T13:41:35.876573+00:00 shinyapps[2156953]: 
2020-04-21T13:41:35.876575+00:00 shinyapps[2156953]: Listening on http://127.0.0.1:43229
2020-04-21T13:52:38.234087+00:00 shinyapps[2156953]: Server version: 1.8.2-10
2020-04-21T13:52:38.234090+00:00 shinyapps[2156953]: LANG: it_IT.UTF-8
2020-04-21T13:52:38.234125+00:00 shinyapps[2156953]: R version: 3.6.3
2020-04-21T13:52:38.234125+00:00 shinyapps[2156953]: shiny version: 1.4.0.2
2020-04-21T13:52:38.234126+00:00 shinyapps[2156953]: httpuv version: 1.5.2
2020-04-21T13:52:38.234126+00:00 shinyapps[2156953]: rmarkdown version: (none)
2020-04-21T13:52:38.234127+00:00 shinyapps[2156953]: knitr version: 1.28
2020-04-21T13:52:38.234127+00:00 shinyapps[2156953]: jsonlite version: 1.6.1
2020-04-21T13:52:38.234167+00:00 shinyapps[2156953]: RJSONIO version: (none)
2020-04-21T13:52:38.234168+00:00 shinyapps[2156953]: htmltools version: 0.4.0
2020-04-21T13:52:38.234293+00:00 shinyapps[2156953]: Using pandoc: /opt/connect/ext/pandoc2
2020-04-21T13:52:38.365358+00:00 shinyapps[2156953]: Using jsonlite for JSON processing
2020-04-21T13:52:38.373214+00:00 shinyapps[2156953]: 
2020-04-21T13:52:38.373216+00:00 shinyapps[2156953]: Starting R with process ID: '478'
2020-04-21T13:52:38.397609+00:00 shinyapps[2156953]: 
2020-04-21T13:52:38.397610+00:00 shinyapps[2156953]: Attaching package: ‘shinydashboard’
2020-04-21T13:52:38.397611+00:00 shinyapps[2156953]: 
2020-04-21T13:52:38.398417+00:00 shinyapps[2156953]: The following object is masked from ‘package:graphics’:
2020-04-21T13:52:38.398417+00:00 shinyapps[2156953]: 
2020-04-21T13:52:38.398418+00:00 shinyapps[2156953]:     box
2020-04-21T13:52:38.398418+00:00 shinyapps[2156953]: 
2020-04-21T13:52:39.594450+00:00 shinyapps[2156953]: Carico il pacchetto richiesto: sp
2020-04-21T13:52:39.615451+00:00 shinyapps[2156953]: 
2020-04-21T13:52:39.615451+00:00 shinyapps[2156953]: Attaching package: ‘rsconnect’
2020-04-21T13:52:39.615452+00:00 shinyapps[2156953]: 
2020-04-21T13:52:39.615774+00:00 shinyapps[2156953]: The following object is masked from ‘package:shiny’:
2020-04-21T13:52:39.615775+00:00 shinyapps[2156953]: 
2020-04-21T13:52:39.615776+00:00 shinyapps[2156953]:     serverInfo
2020-04-21T13:52:39.615776+00:00 shinyapps[2156953]: 
2020-04-21T13:52:41.294083+00:00 shinyapps[2156953]: 
2020-04-21T13:52:41.351588+00:00 shinyapps[2156953]:  Path to GDAL shared files: /usr/share/gdal/2.2
2020-04-21T13:52:41.294086+00:00 shinyapps[2156953]: Attaching package: ‘FRK’
2020-04-21T13:52:41.351588+00:00 shinyapps[2156953]:  GDAL binary built with GEOS: TRUE 
2020-04-21T13:52:41.294087+00:00 shinyapps[2156953]: 
2020-04-21T13:52:41.351588+00:00 shinyapps[2156953]:  Loaded PROJ.4 runtime: Rel. 4.9.2, 08 September 2015, [PJ_VERSION: 492]
2020-04-21T13:52:41.294414+00:00 shinyapps[2156953]: The following object is masked from ‘package:raster’:
2020-04-21T13:52:41.351589+00:00 shinyapps[2156953]:  Path to PROJ.4 shared files: (autodetected)
2020-04-21T13:52:41.294414+00:00 shinyapps[2156953]: 
2020-04-21T13:52:41.351590+00:00 shinyapps[2156953]:  Linking to sp version: 1.4-1 
2020-04-21T13:52:41.294415+00:00 shinyapps[2156953]:     distance
2020-04-21T13:52:41.357647+00:00 shinyapps[2156953]: Linking to GEOS 3.5.1, GDAL 2.2.2, PROJ 4.9.2
2020-04-21T13:52:41.294415+00:00 shinyapps[2156953]: 
2020-04-21T13:52:41.393057+00:00 shinyapps[2156953]: pdfCluster 1.0-3
2020-04-21T13:52:41.351586+00:00 shinyapps[2156953]:  Geospatial Data Abstraction Library extensions to R successfully loaded
2020-04-21T13:52:41.351584+00:00 shinyapps[2156953]: rgdal: version: 1.4-8, (SVN revision 845)
2020-04-21T13:52:41.351587+00:00 shinyapps[2156953]:  Loaded GDAL runtime: GDAL 2.2.2, released 2017/09/15
2020-04-21T13:52:42.209741+00:00 shinyapps[2156953]: 
2020-04-21T13:52:42.209744+00:00 shinyapps[2156953]: Listening on http://127.0.0.1:33507
2020-04-21T14:11:25.889164+00:00 shinyapps[2156953]: Using jsonlite for JSON processing
2020-04-21T14:11:25.898459+00:00 shinyapps[2156953]: 
2020-04-21T14:11:25.898460+00:00 shinyapps[2156953]: Starting R with process ID: '28'
2020-04-21T14:11:25.934762+00:00 shinyapps[2156953]: 
2020-04-21T14:11:25.934763+00:00 shinyapps[2156953]: Attaching package: ‘shinydashboard’
2020-04-21T14:11:25.934764+00:00 shinyapps[2156953]: 
2020-04-21T14:11:25.935588+00:00 shinyapps[2156953]: The following object is masked from ‘package:graphics’:
2020-04-21T14:11:25.935589+00:00 shinyapps[2156953]: 
2020-04-21T14:11:25.935589+00:00 shinyapps[2156953]:     box
2020-04-21T14:11:25.935590+00:00 shinyapps[2156953]: 
2020-04-21T14:11:27.677835+00:00 shinyapps[2156953]: Carico il pacchetto richiesto: sp
2020-04-21T14:11:27.708851+00:00 shinyapps[2156953]: 
2020-04-21T14:11:27.708859+00:00 shinyapps[2156953]: Attaching package: ‘rsconnect’
2020-04-21T14:11:27.708860+00:00 shinyapps[2156953]: 
2020-04-21T14:11:27.709157+00:00 shinyapps[2156953]: The following object is masked from ‘package:shiny’:
2020-04-21T14:11:27.709158+00:00 shinyapps[2156953]: 
2020-04-21T14:11:27.709159+00:00 shinyapps[2156953]:     serverInfo
2020-04-21T14:11:27.709159+00:00 shinyapps[2156953]: 
2020-04-21T14:11:29.872612+00:00 shinyapps[2156953]: 
2020-04-21T14:11:29.872614+00:00 shinyapps[2156953]: Attaching package: ‘FRK’
2020-04-21T14:11:29.872615+00:00 shinyapps[2156953]: 
2020-04-21T14:11:29.872981+00:00 shinyapps[2156953]: The following object is masked from ‘package:raster’:
2020-04-21T14:11:29.872982+00:00 shinyapps[2156953]: 
2020-04-21T14:11:29.872983+00:00 shinyapps[2156953]:     distance
2020-04-21T14:11:29.872983+00:00 shinyapps[2156953]: 
2020-04-21T14:11:29.947836+00:00 shinyapps[2156953]: rgdal: version: 1.4-8, (SVN revision 845)
2020-04-21T14:11:29.947839+00:00 shinyapps[2156953]:  Geospatial Data Abstraction Library extensions to R successfully loaded
2020-04-21T14:11:29.947840+00:00 shinyapps[2156953]:  Loaded GDAL runtime: GDAL 2.2.2, released 2017/09/15
2020-04-21T14:11:29.947840+00:00 shinyapps[2156953]:  Path to GDAL shared files: /usr/share/gdal/2.2
2020-04-21T14:11:29.947841+00:00 shinyapps[2156953]:  GDAL binary built with GEOS: TRUE 
2020-04-21T14:11:29.947841+00:00 shinyapps[2156953]:  Loaded PROJ.4 runtime: Rel. 4.9.2, 08 September 2015, [PJ_VERSION: 492]
2020-04-21T14:11:29.947848+00:00 shinyapps[2156953]:  Path to PROJ.4 shared files: (autodetected)
2020-04-21T14:11:29.947849+00:00 shinyapps[2156953]:  Linking to sp version: 1.4-1 
2020-04-21T14:11:29.957955+00:00 shinyapps[2156953]: Linking to GEOS 3.5.1, GDAL 2.2.2, PROJ 4.9.2
2020-04-21T14:11:30.033187+00:00 shinyapps[2156953]: pdfCluster 1.0-3
2020-04-21T14:11:31.243803+00:00 shinyapps[2156953]: 
2020-04-21T14:11:31.243805+00:00 shinyapps[2156953]: Listening on http://127.0.0.1:38582

since you added this library, you still get the same original problem ?
I think you would need to watch the stream till it logs an error, from the part that you shared it seems to show only that it started to work....

The problem disappeared the moment I added the gbm library
https://agronomofiorentini.shinyapps.io/smart_farming_app_upgrade/

Thank you
#TeamWork