Shiny app running in rstudio-server doesn't work

Hello everyone,

I am having a very strange problem. I have a shiny app running in a rstudio-server at my office. When I run the app from my notebook with a VPN connection it works fine, but when I get the app running from my PC in the office I get the UI visualization ok, but I do not get the server response. The first code lines that I have in the server is to open 3 shp files and when I run the app from my PC in the office nothing happens.

This is my sessionInfo ():

R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
[1] LC_CTYPE=es_AR.UTF-8 LC_NUMERIC=C LC_TIME=es_AR.UTF-8 LC_COLLATE=es_AR.UTF-8 LC_MONETARY=es_AR.UTF-8 LC_MESSAGES=es_AR.UTF-8
[7] LC_PAPER=es_AR.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=es_AR.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] waiter_0.2.5 fields_13.3 spam_2.8-0 raster_3.5-15 rgdal_1.5-32 sp_1.4-6 shinydashboard_0.7.2 shinyWidgets_0.7.0
[9] shiny_1.7.1 magrittr_2.0.3 viridis_0.6.2 viridisLite_0.4.0

loaded via a namespace (and not attached):
[1] Rcpp_1.0.8 pillar_1.7.0 compiler_3.6.3 bslib_0.3.1 later_1.3.0 jquerylib_0.1.4 tools_3.6.3 dotCall64_1.0-1 digest_0.6.29 lattice_0.20-40
[11] jsonlite_1.8.0 lifecycle_1.0.1 tibble_3.1.8 gtable_0.3.0 pkgconfig_2.0.3 rlang_1.0.4 cli_3.1.1 fastmap_1.1.0 terra_1.5-21 gridExtra_2.3
[21] maps_3.4.0 vctrs_0.3.8 sass_0.4.1 grid_3.6.3 glue_1.6.2 R6_2.5.1 fansi_1.0.2 ggplot2_3.3.6 codetools_0.2-16 scales_1.2.0
[31] promises_1.2.0.1 ellipsis_0.3.2 htmltools_0.5.2 mime_0.12 colorspace_2.0-3 xtable_1.8-4 httpuv_1.6.5 utf8_1.2.2 munsell_0.5.0 crayon_1.5.0

Thank you very much for your help!

Are you using file.choose to open the shp files?

If this is the case it will only work on the PC hosting the R session.

Consider using fileInput to allow users to upload files.

However, regarding this please keep in mind:

By default, the user can only upload files up to 5 MB. You can increase this limit by setting the shiny.maxRequestSize option prior to starting Shiny. For example, to allow up to 10 MB run options(shiny.maxRequestSize = 10 * 1024^2).

source:

Thank you for the answer ismirsehregal!

No no, I am using readOGR from rgdal package. I am using selectInput for the options of the shp files, I leave the user to decide but only with a limit of possibilities. Could it be readOGR the problem?

I know Mastering Shiny book, it is a very wonderful book. Thanks!

That sounds like a reasonable approach. I don't think readOGR causes a problem if it works when accessed from another client PC.

Are there any messages in the browser's console?

No, the message I get is this one:

Loading required package: shiny
Loading required package: viridisLite

Attaching package: ‘shinydashboard’

The following object is masked from ‘package:graphics’:

box

Loading required package: sp
Please note that rgdal will be retired by the end of 2023,
plan transition to sf/stars/terra functions using GDAL and PROJ
at your earliest convenience.

rgdal: version: 1.5-32, (SVN revision 1176)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 3.0.4, released 2020/01/28
Path to GDAL shared files: /usr/share/gdal
GDAL binary built with GEOS: TRUE
Loaded PROJ runtime: Rel. 6.3.1, February 10th, 2020, [PJ_VERSION: 631]
Path to PROJ shared files: /usr/share/proj
Linking to sp version:1.5-0
To mute warnings of possible GDAL/OSR exportToProj4() degradation,
use options("rgdal_show_exportToProj4_warnings"="none") before loading sp or rgdal.
Loading required package: spam
Spam version 2.8-0 (2022-01-05) is loaded.
Type 'help( Spam)' or 'demo( spam)' for a short introduction
and overview of this package.
Help for individual functions is also obtained by adding the
suffix '.spam' to the function name, e.g. 'help( chol.spam)'.

Attaching package: ‘spam’

The following objects are masked from ‘package:base’:

backsolve, forwardsolve

Try help(fields) to get started.
The name provided ('refresh') is deprecated in Font Awesome 5:

  • please consider using 'sync' or 'fas fa-sync' instead
  • use the verify_fa = FALSE to deactivate these messages

Listening on http://127.0.0.1:5381

And then, it should appear the messages of readOGR but I don't get them. Could be a problem of firewall or something like that?

That's the output of your R console. How about the output of your browser's console when trying to access the shiny app? In e.g. chrome use ctrl+shift+i to access the console.

Ah ok yes, sorry. No, I don't get messages. Nothing at all. You only get the UI visualization.

Hello again to everyone,

Does anyone know what it could be the problem?

Thank you!

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.