R Shiny dev on RStudio server Shiny app startup crashes
I'm new to Shiny but not new to R. Due to work I am currently doing R development on RStudio server. It is powered by the Google Compute Engine, if that matters. The RStudio server works fine, but Shiny is having problems.
After installing the gloss, I ran the example command:
runExample ("01_hello")
First, it brought up Hello Shiny! app, but everything was grayed out. I restarted RStudio, cleared the workspace and ran the command again. Now a window appears, but it disappears immediately. I tried restarting RStudio server and working in another browser, but the behavior continues.
I tried to quickly click the "Open in Browser" button and it made me log into my browser, grayed out like before I restarted.
Any suggestions? Thank.
EDIT:
When I run this example, the RStudio console gives:
Listening on http://127.0.0.1:4096
And just sits there until I press esc.
The IE console is giving no errors (although I'm also not sure if I'm using it correctly - not the web guy, sorry).
Chrome console gives error:
'webkitRequestAnimationFrame' is vendor specific. Please use the standard 'requestAnimationFrame'.
Who has a link to VM320: 6635 which reads:
function _b (b, c) {var d = b; var e = Gni (function () {var a = wj (); d.Df (a)}); return $ wnd.webkitRequestAnimationFrame (e, c)}
source to share
I figured out my problem, mostly. The window still closes as soon as I launch the Shiny app, but now I can go to the Shiny app. This is good enough for me to review this fixed.
I had to do two things. First, I had to open the port that Shiny was listening on using the GCE command line, which was the second answer here using the command line: How to open a specific port like 9090 in Google Compute Engine
Then I had to launch the Shiny app with the following command:
runExample("01_hello", host="0.0.0.0", port=9999)
It works with the team runApp
. 9999 is the port number you open with GCE and host=0.0.0.0
seems to tell Shiny to listen for external connections (from the in-R help documentation ?runApp
). You need to literally enter 0.0.0.0, not the IP address of your machine or something.
Even though the window is closed when I run this example, I can both go to the external IP of the instance with a port number and use the Shiny app.
Thank you for your help. Please feel free to comment if you think you need to say more.
source to share
I got the same issue after installing RStudio Server and Shiny Server on my VPS and then tried to set up an Apache proxy so I could use www.example.com/rstudio to access the IDE instead of the default www.example.com application :. 8787
I did it wrong at first and had the same problem as you, but here I found the correct solution: https://support.rstudio.com/hc/en-us/articles/200552326-Running-with-a-Proxy
The immediate cause was the missing websocket proxy configuration:
ProxyPassMatch ^/rstudio/p/([0-9]+)/(websocket|.*/websocket)/$ ws://localhost:8787/p/$1/$2/
source to share
To check if the problem is on the RStudio server or elsewhere, run this single file application in R (copy paste to R terminal):
library(shiny)
server <- function(input, output) {
output$distPlot <- renderPlot({
hist(rnorm(input$obs), col = 'darkgray', border = 'white')
})
}
ui <- shinyUI(fluidPage(
sidebarLayout(
sidebarPanel(
sliderInput("obs", "Number of observations:", min = 10, max = 500, value = 100)
),
mainPanel(plotOutput("distPlot"))
)
))
shinyApp(ui = ui, server = server)
I found a google group discussion about a problem with the Rstudio server , so it is possible that it is some kind of compatibility issue.
source to share