Failed to load resource

I have shiny server open and Rstudio server open running on a CentOS machine. Everything was working fine yesterday and I clicked on "Check for package updates" in Rstudio server and did select all and now my shiny apps are not displaying properly and they do not work. I don't know if those two are related, but that is the only thing I can think of that changed. Chrome inspector shows that all the resources are not being loaded. Might be a simple fix, but I can't figure it out. Please see full list below. These are not resources I am calling myself. Please give me any hints on how to debug this. Thanks in advance.

Failed to load resource: the server responded with a status of 404 (Not Found)
shiny.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
all.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
v4-shims.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
bootstrap-datepicker3.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
bootstrap.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
AdminLTE.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
_all-skins.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
shinydashboard.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
jquery.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
shiny.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
bootstrap-datepicker.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
bootstrap.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
html5shiv.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
respond.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
shiny.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
app.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
shinydashboard.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
all.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
v4-shims.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
bootstrap-datepicker3.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
bootstrap-datepicker.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
(index):18 Uncaught ReferenceError: $ is not defined
    at (index):18
    at (index):20
bootstrap.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
bootstrap.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
html5shiv.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
respond.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
AdminLTE.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
_all-skins.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
app.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
shinydashboard.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
shinydashboard.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
shiny-server-client.min.js:2 Uncaught TypeError: $ is not a function
    at new ReconnectUI (shiny-server-client.min.js:2)
    at Object.<anonymous> (shiny-server-client.min.js:1)
    at Object.16../decorators/connection-context (shiny-server-client.min.js:1)
    at s (shiny-server-client.min.js:1)
    at e (shiny-server-client.min.js:1)
    at shiny-server-client.min.js:1
(index):35 Uncaught ReferenceError: preShinyInit is not defined
    at (index):35
shiny.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
all.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
v4-shims.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
bootstrap-datepicker3.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
bootstrap.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
AdminLTE.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
_all-skins.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
shinydashboard.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)

This looks the same as https://github.com/rstudio/shiny/issues/2372. It might be related to upgrading to Shiny 1.3.0. Can you provide your session info in that issue, as well as a reproducible app, if possible?

Thanks for the reply Winston. Yes, I am using Shiny 1.3.0. I will work on posting an app.

13:56:35 > sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.4 (Maipo)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8 LC_ADDRESS=en_US.UTF-8 LC_TELEPHONE=en_US.UTF-8 LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8

attached base packages:
[1] datasets utils stats graphics grDevices methods base

other attached packages:
[1] shiny_1.3.0 shinydashboard_0.7.1 googledrive_0.1.3 DBI_1.0.0 jsonlite_1.6 stringi_1.4.3 ONJob_0.1.5 XLConnect_0.2-15 XLConnectJars_0.2-15
[10] dtplyr_0.0.3 data.table_1.12.2 dplyr_0.8.0.1 plyr_1.8.4 testthat_2.0.1 lubridate_1.7.4 timeDate_3043.102 sendmailR_1.2-1 rmarkdown_1.12
[19] usethis_1.5.0 devtools_2.0.2 xts_0.11-2 zoo_1.8-5 MASS_7.3-51.1 fortunes_1.5-4

loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 lattice_0.20-38 prettyunits_1.0.2 ps_1.3.0 assertthat_0.2.1 rprojroot_1.3-2 digest_0.6.18 mime_0.6 R6_2.4.0 odbc_1.1.6
[11] backports_1.1.3 evaluate_0.13 pillar_1.3.1 rlang_0.3.4 rstudioapi_0.10 callr_3.2.0 blob_1.1.1 desc_1.2.0 stringr_1.4.0 bit_1.1-14
[21] compiler_3.5.2 httpuv_1.5.1 xfun_0.6 pkgconfig_2.0.2 base64enc_0.1-3 pkgbuild_1.0.3 htmltools_0.3.6 tidyselect_0.2.5 tibble_2.1.1 crayon_1.3.4
[31] withr_2.1.2 later_0.8.0 grid_3.5.2 xtable_1.8-3 magrittr_1.5 cli_1.1.0 fs_1.2.7 promises_1.0.1 remotes_2.0.2 tools_3.5.2
[41] bit64_0.9-7 glue_1.3.1 purrr_0.3.2 hms_0.4.2 processx_3.3.0 pkgload_1.0.2 yaml_2.2.0 sessioninfo_1.1.1 memoise_1.1.0 rJava_0.9-11
[51] knitr_1.22

Here is my reprex. It works fine on my windows machine with Shiny 1.3.0 and shinydashboard 0.7.1, but does not render properly and does not run on my CentOS machine, also with Shiny 1.3.0 and shinydashboard 0.7.1.

app.R

library(shinydashboard)
library(shiny)
library(data.table)

#################################################################################
header <- dashboardHeader(title = "ID Lookup")

sidebar <- dashboardSidebar(
    radioButtons(inputId="portType", label="Identifier Type", choices=c("Symbol","CUSIP","Name","GVKEY"), selected = "Symbol"),
    textInput(inputId="id", label="Identifier", value="valu")
)

body <- dashboardBody(
    h4("Results"),
    DT::dataTableOutput("out")
)

ui <- dashboardPage(header, sidebar, body)

server <- function(input, output) {

    trim = function(x) gsub("^[[:space:]]+|[[:space:]]+$", "", x)

    output$test <- renderText({
        portType = trim(input$portType)
        portType
    })

    output$out <- DT::renderDataTable({
        portType = trim(input$portType)
        id = trim(input$id)

        go <- data.table(id, portType, "test"=1:10)
    }, options = list(dom = 't'))

}

On your CentOS machine, can you test it in Shiny Server as well as in a plain R process? I wonder if it's related to Shiny Server in your case.

Sorry, I just want to check -- are you running Shiny Server? If not, then disregard my previous message.

Yes, it does not work in either. The rendering is exactly the same. It just prints the text of the app without any formatting:

ID Lookup
Toggle navigation
Identifier Type
Symbol
CUSIP
Name
GVKEY
Identifier

Results

Yes, as part of my debugging before posting I upgraded to the latest version of the open-source shiny server: shiny-server-1.5.9.923-x86_64.rpm

FYI, I downgraded to Shiny 1.2.0 and now everything is working fine again. That is the only package I downgraded. As I mentioned before, Shiny 1.3.0 seems to work fine on my windows 7 machine, but not CentOS 7.4. Shiny 1.2.0 works fine.

@rogerjbos Any chance you're able to screenshare with us live right now? We really want to figure this one out...

Yes, I am happy to. How?

Check your direct messages - we can communicate there.

We figured out that the problem was an incorrectly configured proxy. The problem was with nginx's proxy_set_header directive. This is the incorrect value:

     proxy_set_header Connection "upgrade"

To get it to work, it should look something like this:

  map $http_upgrade $connection_upgrade {
      default upgrade;
      ''      close;
    }

[ ... a bunch of stuff ... ]
      proxy_set_header Connection $connection_upgrade;

Please see this article for more details:

1 Like

Thanks again. Here is the incorrect and correct proxy config:

    # Open shiny server - NOT WORKING
    location /apps/ {
      proxy_pass http://127.0.0.1:3838/apps/;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
    }

    # Open shiny server - FIXED
    location /apps/ {
      proxy_pass http://127.0.0.1:3838/apps/;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      #proxy_set_header Connection "upgrade";
      proxy_set_header Connection $connection_upgrade;
      proxy_read_timeout 20d;
      proxy_buffering off;
    }

We've merged a pull request in httpuv which makes it more lenient with proxies that are misconfigured this way. It can be installed with:

devtools::install_github('rstudio/httpuv')

Hi there,
I'm not sure whether I should open a new topic or post here.
I'm working on a windows 10 with local R/RStudio installed.
A few days again I updated R to v3.5.3 and RStudio to v1.2.1330.
I didn't check my app immediately, only a few days later. Meanwhile I had to install many Julia/Atom-Juno packages for a training and now when I run (locally) an app I'm working on, all the images are gone.
The app looked like that : https://drees.shinyapps.io/Cartographie_des_indicateurs/ (I didn't try to redeploy, even if, being another OS it might still work) I can only add to links in the post, you can find the link to the github repo on the top-right of the app.

Here is a simple reprex

within app.R (ran within an RStudio project)

library(shiny)
download.file(url = "https://www.rstudio.com/wp-content/uploads/2019/03/RStudio-Logo-Blue-Gray-125.png",
              destfile = "www/rstudio.png",mode = "wb")#I have to add this for windows 10
shinyApp(
  ui = fluidPage(
    tags$img(src="https://www.rstudio.com/wp-content/uploads/2019/03/RStudio-Logo-Blue-Gray-125.png"),
    tags$img(src="rstudio.png")
  ),
  server = function(input, output) { }
)

The LOCAL image doesn't render, instead I have a broken image. (the one I get from URL is OK)
When I open the Chrome inspector and check the JS console I have the following error

Failed to load resource: the server responded with a status of 404 (Not Found) rstudio.png:1

I tried to check the reprex with the latest rocker/rstudio image but I can't reproduce it. Probably because it's a Windows 10 related issue.

Here is my sessionInfo()

R version 3.5.3 (2019-03-11)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)

Matrix products: default

locale:
[1] LC_COLLATE=French_France.1252 
[2] LC_CTYPE=French_France.1252   
[3] LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C                  
[5] LC_TIME=French_France.1252    

attached base packages:
[1] stats     graphics 
[3] grDevices utils    
[5] datasets  methods  
[7] base     

other attached packages:
[1] shiny_1.3.1

loaded via a namespace (and not attached):
 [1] compiler_3.5.3 
 [2] magrittr_1.5   
 [3] R6_2.4.0       
 [4] promises_1.0.1 
 [5] later_0.8.0    
 [6] htmltools_0.3.6
 [7] tools_3.5.3    
 [8] Rcpp_1.0.1     
 [9] jsonlite_1.6   
[10] digest_0.6.18  
[11] xtable_1.8-3   
[12] httpuv_1.5.1   
[13] mime_0.6  

I tried re-installing R v3.5.3 & latest RStudio v1.2.1335, it doesn't fix it.

What troubles me most is that some of the apps render all the images without any problem.
For example this one works alright : https://github.com/phileas-condemine/trafic_dataviz.drees

I tried to go back to R 3.5.2, shiny 1.2.0, it fixes the problem.

sessionInfo()

R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)

Matrix products: default

locale:
[1] LC_COLLATE=French_France.1252 
[2] LC_CTYPE=French_France.1252   
[3] LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C                  
[5] LC_TIME=French_France.1252    

attached base packages:
[1] stats     graphics 
[3] grDevices utils    
[5] datasets  methods  
[7] base     

other attached packages:
 [1] bsplus_0.1.1         
 [2] shinycssloaders_0.2.0
 [3] markdown_0.9         
 [4] stringr_1.3.1        
 [5] shinyBS_0.61         
 [6] shinydashboard_0.7.1 
 [7] shinyjs_1.0          
 [8] V8_2.2               
 [9] shinyWidgets_0.4.4   
[10] DT_0.5               
[11] data.table_1.12.0    
[12] dplyr_0.7.8          
[13] shiny_1.2.0          

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.0      
 [2] pillar_1.3.1    
 [3] compiler_3.5.2  
 [4] later_0.8.0     
 [5] bindr_0.1.1     
 [6] tools_3.5.2     
 [7] digest_0.6.18   
 [8] packrat_0.5.0   
 [9] lubridate_1.7.4 
[10] jsonlite_1.6    
[11] tibble_2.0.1    
[12] pkgconfig_2.0.2 
[13] rlang_0.3.1     
[14] rstudioapi_0.9.0
[15] crosstalk_1.0.0 
[16] yaml_2.2.0      
[17] curl_3.3        
[18] bindrcpp_0.2.2  
[19] htmlwidgets_1.3 
[20] tidyselect_0.2.5
[21] glue_1.3.0      
[22] R6_2.3.0        
[23] purrr_0.3.0     
[24] magrittr_1.5    
[25] scales_1.0.0    
[26] promises_1.0.1  
[27] htmltools_0.3.6 
[28] assertthat_0.2.0
[29] mime_0.6        
[30] xtable_1.8-3    
[31] colorspace_1.4-0
[32] httpuv_1.5.1    
[33] stringi_1.2.4   
[34] munsell_0.5.0   
[35] crayon_1.3.4    

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