Shiny App not working after v1.3

Hi friends!

We have being using kubernetes to deploy our shiny apps using shiny server pro on a cluster for the past year. It has been working perfectly. However after the shiny v1.3 come out there has been some issues.

After v1.3, our apps stoped working. The app url returned "400 Bad Request" error. What I found is this somehow related to the www folder we have in the shiny app directory. So our shiny apps directory structure is like this ../shiny-server/a/app1, ../shiny-server/a/app2 etc. In ../shiny-server/a/app1 we have the server.R, ui.R, global.R files, and in ../shiny-server/a/app1/www folder we put the pdfs and images we use in our app. If we rename the www folder to something else, the apps start running again, but all the static files from shiny packages are not loaded except for sockjs-0.3.4.min.js, shiny-server-client.min.js, shiny-server.css. See the image below.
pic_3
If I use shiny 1.2 and its related dependencies instead, everything works fine again. The www problem goes away, and all the static files loads normally.

This is the not working docker file.

FROM r-base:latest
ENV http_proxy ""
ENV https_proxy ""

RUN apt-get update && apt-get install -y --allow-downgrades \
    gdebi-core \
    gsl-bin \
    libcurl4-gnutls-dev \
    libgsl0-dev \
    libxt6=1:1.1.5-1+b3 \
    libxt-dev \
    pandoc \
    pandoc-citeproc \
    sudo \
    libglib2.0-0 \
    libglib2.0-dev \
    libcairo2-dev \
    rrdtool \
    libpq-dev \
    libgdal-dev \
    libudunits2-dev \
    libssl-dev \
    psmisc

RUN R -e "install.packages(c( 'shiny', 'shinydashboard', 'dplyr', 'PerformanceAnalytics', 'tseries', 'zoo', 'TTR', 'quantmod', 'ggvis', 'reshape', 'plyr', 'leaflet', 'DT', 'RPostgreSQL', 'shinyWidgets', 'shinyBS', 'rjson', 'reshape2', 'data.table', 'maps', 'tigris', 'optparse', 'pool', 'tidyr', 'dygraphs' ), repos='http://cran.rstudio.com/')"

RUN MD5="c3146eaa5ba5f757d1088b5217c2a313" && \
    wget --no-verbose http://ftp.us.debian.org/debian/pool/main/g/glibc/multiarch-support_2.19-18+deb8u10_amd64.deb && \
    echo "$MD5 multiarch-support_2.19-18+deb8u10_amd64.deb" | md5sum -c - && \
    dpkg -i multiarch-support_2.19-18+deb8u10_amd64.deb && \
    rm -f multiarch-support_2.19-18+deb8u10_amd64.deb

RUN MD5="988393d399c0c8776e0e05a505e68fe0" &&\
    wget --no-verbose http://security-cdn.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u11_amd64.deb && \
    echo "$MD5 libssl1.0.0_1.0.1t-1+deb8u11_amd64.deb" | md5sum -c - && \
    dpkg -i libssl1.0.0_1.0.1t-1+deb8u11_amd64.deb && \
    rm -f libssl1.0.0_1.0.1t-1+deb8u11_amd64.deb

RUN wget https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb
RUN echo "9af7440986893c904f24c086c50846ddc5a0f24864f5566b747b8f1a17f7fd52 "\
         "dumb-init_1.2.0_amd64.deb" | sha256sum -c -
RUN dpkg -i dumb-init_1.2.0_amd64.deb


# Download and install shiny server
RUN VERSION=1.5.10.990 && \
    # WARNING: if we use a new version here we must test that log out, and logging still works
    MD5="e70f46f8c43191be606dd507e33ed3c5" && \
    wget --no-verbose "https://s3.amazonaws.com/rstudio-shiny-server-pro-build/ubuntu-14.04/x86_64/shiny-server-commercial-$VERSION-amd64.deb" -O ss-latest.deb && \
    echo "$MD5 ss-latest.deb" | md5sum -c - && \
    gdebi -n ss-latest.deb && \
    rm -f version.txt ss-latest.deb

COPY app /srv/shiny-server/
COPY app/templates /etc/shiny-server/templates/
COPY app/shiny-server.sh /usr/bin/shiny-server.sh
COPY app/docker_entrypoint.sh /usr/bin/docker_entrypoint.sh
COPY app/dev-server.sh /usr/bin/dev-server.sh

EXPOSE 3838

ENTRYPOINT ["dumb-init", "--"]
CMD ["/bin/bash", "/usr/bin/docker_entrypoint.sh"]

This is the working docker file.

FROM r-base:latest
ENV http_proxy ""
ENV https_proxy ""

RUN apt-get update && apt-get install -y --allow-downgrades \
    gdebi-core \
    gsl-bin \
    libcurl4-gnutls-dev \
    libgsl0-dev \
    libxt6=1:1.1.5-1+b3 \
    libxt-dev \
    pandoc \
    pandoc-citeproc \
    sudo \
    libglib2.0-0 \
    libglib2.0-dev \
    libcairo2-dev \
    rrdtool \
    libpq-dev \
    libgdal-dev \
    libudunits2-dev \
    libssl-dev \
    psmisc

RUN R -e "install.packages(c( 'mime', 'jsonlite', 'digest', 'htmltools', 'R6', 'sourcetools', 'later', 'promises', 'crayon' ), repos='http://cran.rstudio.com/')"
RUN R -e "install.packages('http://cran.r-project.org/src/contrib/Archive/xtable/xtable_1.8-3.tar.gz', repos=NULL, type='source')"
RUN R -e "install.packages('http://cran.r-project.org/src/contrib/Archive/rlang/rlang_0.3.1.tar.gz', repos=NULL, type='source')"
RUN R -e "install.packages('http://cran.r-project.org/src/contrib/Archive/httpuv/httpuv_1.5.0.tar.gz', repos=NULL, type='source')"
RUN R -e "install.packages('http://cran.r-project.org/src/contrib/Archive/shiny/shiny_1.2.0.tar.gz', repos=NULL, type='source')"

RUN R -e "install.packages(c( 'shinydashboard', 'dplyr', 'PerformanceAnalytics', 'tseries', 'zoo', 'TTR', 'quantmod', 'ggvis', 'reshape', 'plyr', 'leaflet', 'DT', 'RPostgreSQL', 'shinyWidgets', 'shinyBS', 'rjson', 'reshape2', 'data.table', 'maps', 'tigris', 'optparse', 'pool', 'tidyr', 'dygraphs' ), repos='http://cran.rstudio.com/')"

RUN MD5="c3146eaa5ba5f757d1088b5217c2a313" && \
    wget --no-verbose http://ftp.us.debian.org/debian/pool/main/g/glibc/multiarch-support_2.19-18+deb8u10_amd64.deb && \
    echo "$MD5 multiarch-support_2.19-18+deb8u10_amd64.deb" | md5sum -c - && \
    dpkg -i multiarch-support_2.19-18+deb8u10_amd64.deb && \
    rm -f multiarch-support_2.19-18+deb8u10_amd64.deb

RUN MD5="988393d399c0c8776e0e05a505e68fe0" &&\
    wget --no-verbose http://security-cdn.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u11_amd64.deb && \
    echo "$MD5 libssl1.0.0_1.0.1t-1+deb8u11_amd64.deb" | md5sum -c - && \
    dpkg -i libssl1.0.0_1.0.1t-1+deb8u11_amd64.deb && \
    rm -f libssl1.0.0_1.0.1t-1+deb8u11_amd64.deb

RUN wget https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb
RUN echo "9af7440986893c904f24c086c50846ddc5a0f24864f5566b747b8f1a17f7fd52 "\
         "dumb-init_1.2.0_amd64.deb" | sha256sum -c -
RUN dpkg -i dumb-init_1.2.0_amd64.deb


# Download and install shiny server
RUN VERSION=1.5.10.990 && \
    # WARNING: if we use a new version here we must test that log out, and logging still works
    MD5="e70f46f8c43191be606dd507e33ed3c5" && \
    wget --no-verbose "https://s3.amazonaws.com/rstudio-shiny-server-pro-build/ubuntu-14.04/x86_64/shiny-server-commercial-$VERSION-amd64.deb" -O ss-latest.deb && \
    echo "$MD5 ss-latest.deb" | md5sum -c - && \
    gdebi -n ss-latest.deb && \
    rm -f version.txt ss-latest.deb

COPY app /srv/shiny-server/
COPY app/templates /etc/shiny-server/templates/
COPY app/shiny-server.sh /usr/bin/shiny-server.sh
COPY app/docker_entrypoint.sh /usr/bin/docker_entrypoint.sh
COPY app/dev-server.sh /usr/bin/dev-server.sh

EXPOSE 3838

ENTRYPOINT ["dumb-init", "--"]
CMD ["/bin/bash", "/usr/bin/docker_entrypoint.sh"]

Thank you for the docker file, but I can not run it on my end. I do not have the app information for the last copy statements. Is there one we can use from github?


  • Please update to the latest shiny and httpuv versions. Please verify that shiny is v1.3.2 and httpuv is v 1.5.1.

    • I can see that the latest are being downloaded in the broken file.
  • If you use a www/shared folder, please rename it.

    • I don't believe this is the case.

Hi Barret, thank you for helping!
Yeah, post #2372 was the reason that I tried down grading to Shiny 1.2.0, and it did solve our problems although I don't know exactly why...
Sorry but the git repo is private, but a simple hello world app gives me the same problems.
So I created app/hello-world with ui.R, server.R and a www folder under it.

server <- function(input, output, session) {
  
  output$logo <- renderImage({
    list(src = './www_dir/kensho_logo.png')
  })

  output$info <- renderPrint({
        print(sessioninfo::session_info())
  })
}
ui <- fluidPage(
  
  # Application title
  titlePanel("Hello World!"),
  
  # Sidebar with user input elements
  sidebarLayout(
    sidebarPanel(
    ),
    
    # Show a plot
    mainPanel(
      plotOutput("logo"),
      verbatimTextOutput("info")
    )
  )
)

The shiny server config we used is below.

# instruct Shiny Server to run applications as the user "shiny"
run_as shiny;

# preserve_logs true;
license_type floating;

# override certain shiny templates with our own flavors
# originals exist in /opt/shiny-server/templates/
template_dir /etc/shiny-server/templates;

# disable websockets
disable_protocols websocket xdr-streaming xhr-streaming iframe-eventsource iframe-htmlfile;

# Define a server that listens on port 3838
server {
  listen 3838;

  # Define a location at the base URL
  location / {
  # required_user *;
# add session times out when users does not take any action for 10 minutes
  app_session_timeout 600;
 # Host the directory of Shiny Apps stored in this directory
    site_dir /srv/shiny-server;

    # Log all Shiny output to files in this directory
    # Explicitly setting log_dir to this fifo we create in shiny-server.sh
    log_dir /var/log/mosaic.log;

    # When a user visits the base URL rather than a particular application,
    # an index of the applications available in this directory will be shown.
    directory_index on;
  }
}

tldr; I am unable to reproduce the 400 resource errors that I see in your screenshot. I believe this is where we should have you email RStudio support (support@rstudio.com) and they can directly help you solve the issue.


Self contained docker example:

FROM r-base:latest
ENV http_proxy ""
ENV https_proxy ""

RUN apt-get update && apt-get install -y --no-install-recommends apt-utils

RUN apt-get update && apt-get install -y --allow-downgrades \
    gdebi-core \
    gsl-bin \
    libcurl4-gnutls-dev \
    libgsl0-dev \
    libxt6=1:1.1.5-1+b3 \
    libxt-dev \
    pandoc \
    pandoc-citeproc \
    sudo \
    libglib2.0-0 \
    libglib2.0-dev \
    libcairo2-dev \
    rrdtool \
    libpq-dev \
    libgdal-dev \
    libudunits2-dev \
    libssl-dev \
    psmisc

RUN R -e "install.packages(c( 'shiny', 'shinydashboard', 'dplyr', 'PerformanceAnalytics', 'tseries', 'zoo', 'TTR', 'quantmod', 'ggvis', 'reshape', 'plyr', 'leaflet', 'DT', 'RPostgreSQL', 'shinyWidgets', 'shinyBS', 'rjson', 'reshape2', 'data.table', 'maps', 'tigris', 'optparse', 'pool', 'tidyr', 'dygraphs' ), repos='http://cran.rstudio.com/')"

RUN MD5="c3146eaa5ba5f757d1088b5217c2a313" && \
    wget --no-verbose http://ftp.us.debian.org/debian/pool/main/g/glibc/multiarch-support_2.19-18+deb8u10_amd64.deb && \
    echo "$MD5 multiarch-support_2.19-18+deb8u10_amd64.deb" | md5sum -c - && \
    dpkg -i multiarch-support_2.19-18+deb8u10_amd64.deb && \
    rm -f multiarch-support_2.19-18+deb8u10_amd64.deb

RUN MD5="988393d399c0c8776e0e05a505e68fe0" &&\
    wget --no-verbose http://security-cdn.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u11_amd64.deb && \
    echo "$MD5 libssl1.0.0_1.0.1t-1+deb8u11_amd64.deb" | md5sum -c - && \
    dpkg -i libssl1.0.0_1.0.1t-1+deb8u11_amd64.deb && \
    rm -f libssl1.0.0_1.0.1t-1+deb8u11_amd64.deb

RUN wget https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb
RUN echo "9af7440986893c904f24c086c50846ddc5a0f24864f5566b747b8f1a17f7fd52 "\
         "dumb-init_1.2.0_amd64.deb" | sha256sum -c -
RUN dpkg -i dumb-init_1.2.0_amd64.deb

# Download and install shiny server
RUN VERSION=1.5.10.990 && \
    # WARNING: if we use a new version here we must test that log out, and logging still works
    MD5="e70f46f8c43191be606dd507e33ed3c5" && \
    wget --no-verbose "https://s3.amazonaws.com/rstudio-shiny-server-pro-build/ubuntu-14.04/x86_64/shiny-server-commercial-$VERSION-amd64.deb" -O ss-latest.deb && \
    echo "$MD5 ss-latest.deb" | md5sum -c - && \
    gdebi -n ss-latest.deb && \
    rm -f version.txt ss-latest.deb

RUN cd /srv/shiny-server/sample-apps/ && \
    wget https://github.com/rstudio/shiny-examples/archive/master.zip -O master.zip && \
    unzip master.zip
RUN cd /

EXPOSE 3838

CMD ["shiny-server"]

Build and run bash commands:

docker build -t shiny_examples . 
docker run -p 3838:3838 shiny_examples

Please visit on your local machine: http://localhost:3838/sample-apps/shiny-examples-master/054-nvd3-line-chart-output/

If your license code is added, it should display this app: https://github.com/rstudio/shiny-examples/tree/master/054-nvd3-line-chart-output . This app has a www folder needed to display the graphs.

Also checking a local shiny/leaflet application with an image from within a www folder does not cause an error within my docker either.

I can not reproduce the errors and shiny example apps are behaving as expected. Without the extra app information, I can not produce the same error.

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