Shiny App working on R studio server but not on shiny-server (aws-EC2)

shiny-server

#1

Hello,

I have a shiny app on an aws-EC2 instance (r4.xlarge) loading four tables from a database also on aws (postgres).

The app works very well and loads pretty quickly when I run it on the R studio server installed on the same aws-EC2 instance.

But then when I try to visualize the app with http://XX.XXX.X.XXX:3838/my_app/ it does not work and I only get the “An error has occurred The application failed to start. The application exited during initialization.”

When I look at the inspect element, I see “Failed to load resource: the server responded with a status of 500 (Internal Server Error)”

I can make the app work if I reduce the number of rows I pull with collect(mydata, n = Inf). For example, 900000 instead of Inf will work.

I know I can boost the memory of the instance, but I would like to understand why it is working on the r studio server but not with http://XX.XXX.X.XXX:3838/my_app/?

I also added this to my shiny-server.conf file with no success.

app_init_timeout 300;

app_idle_timeout 300;

Any suggestions? Did I miss something?

thank you!

EDIT:
I added sanitize_errors false; to my shiny-server.conf. It gave me some info and helped to fix a few errors.
But then still did not work and gave me this error: “su: ignore --preserve-environment, it’s mutually exclusive to --login.”
After refreshing the app. It worked. So I am a little bit confused.

Martin


#2

Hi Martin, I recommend looking at the application log files. I suspect your Shiny Server machine's configuration differs from your RStudio Server machine somehow, and the application's log files would shed some light.

Alternatively, you might consider deploying your application with Packrat so that you can be sure of which packages it uses at runtime.