Shiny App Greys Out in RStudio Cloud: Error during WebSocket handshake

shiny

#1

I created an rstudio cloud project that can be used to run shiny apps (e.g. for teaching). While it worked fairly well initially, now the shiny app greys out when shown in an external browser. There is no error message in the R console, but the Javascript console shows an error like:

shinyapp.js:83 WebSocket connection to 'wss://skranz.rstudio.cloud/11f0ed75a84e47a0b87ab0abd399fa92/p/3620/websocket/' failed:
Error during WebSocket handshake: Unexpected response code: 500

The error arises both under Chrome and Firefox. Initially the error did not arise with R 3.4.4, only under R 3.5. But now I get consistently that problem.

Here is an example project to replicate the problem:

https://rstudio.cloud/project/45034

To start my (RTutor) shiny app, one can simply type:

library(RTutor)
show.ps("Intro", user.name="TestUser")

The project also contains a very simple shiny app called SimpleTestApp that was created by File -> New File -> Shiny Web App. When I open the cloud project and start running SimpleTestApp in an external browser tab, it initially works. Yet, if I then run the RTutor app and afterwards try again running SimpleTestApp, then SimpleTestApp also greys out, with the WebSocket handshake error in the javascript console.

On my local R installation, I never encountered this problem. The RTutor app and my other shiny apps work fine, without Websocket errors.


#2

There is some thinking that there are some issues in httpuv and the RStudio IDE at play here.
I am trying to get to the bottom of what combination is expected to work.




Problem with tutorial on building widget
#3

We merged a fix into httpuv. @skranz can you please try it out? To install it:

devtools::install_github("rstudio/httpuv")

For reference, here is the issue we filed on httpuv:
https://github.com/rstudio/httpuv/issues/161

And here is the pull request:
https://github.com/rstudio/httpuv/pull/162


#4

Great, thanks a lot for that fast fix.

After updating httpuv, it worked directly with Firefox. However, I still got a grey screen and WebSocket error under Chrome. Yet, after restarting my computer and restarting the R session on rstudio.cloud, it also worked for Chrome.

I didn't run a long test series, yet. So I cannot rule out, that it works only with some probability as described in your Github issue. I will let you know if the WebSocket error returns sporadically.


#5

Had the same issue. Works great now! Thanks


#6

FYI @wch I did just notice the following warning after closing the app. This was the latest version of radiant from: install.packages("radiant", repos = "https://radiant-rstats.github.io/minicran/")

Listening on http://127.0.0.1:5579
Failed to create bus connection: No such file or directory
Warning in system("timedatectl", intern = TRUE) :
  running command 'timedatectl' had status 1

Stopped Radiant. State information is available in the r_state and r_info lists and the r_data environment. Use attach(r_data) to access data loaded into Radiant.

Project id: https://rstudio.cloud/project/45908