What does "Disconnected from Server" mean in shinyapps.io?


The "Disconnected from Server" error is a generic message that means that the R session has shut down for some reason.  This could happen for a multitude of reasons, ranging from missing objects, to data that takes too long to load, to the use of forbidden packages, to hitting the application timeout settings.

The first thing you should do when encountering this error is check the application log.  This can be accessed in the shinyapps.io dashboard, under the Logs tab in the Application view, or by running rsconnect::showLogs() in the RStudio console.

This log will contain information about the startup and running of your application.  Any errors encountered along the way will be shown here, comparable to the log created when you run the shiny application locally in your own R process.

It may also help to check the Javascript console in your browser while the application is running, which may show additional errors and messages related to your application. The exact instructions for checking this will vary depending on your browser, but you can find instructions for major browsers here.

If you see errors related to the data, code, or workspace of the application, you will need to fix them before the application will load properly.  Remember that applications deployed to shinyapps.io must be independent and self-contained, so all the data, workspace objects, and other resources that the app needs must be deployed with it, or accessible via the internet.

Even if there is no error in the application log, the problem may still lie within your code. There are many resources available online to assist you in debugging and optimizing your app, including our Debugging Shiny Applications article, and the shinyapps-users Google group.

Be aware that your app may run well locally, but fail on shinyapps.io once it comes under load from multiple users. This could happen for a variety of reasons, including but not limited to:

  • Forgetting to close each database connection after loading in data
  • Making multiple long-running calls to a public API
  • Sub-optimal application instance or worker provisioning

Finally, our Scaling and Tuning article describes best practices regarding optimizing the performance of your shinyapps.io application.