rstudio / rsconnect

Publish Shiny Applications, RMarkdown Documents, Jupyter Notebooks, Plumber APIs, and more
http://rstudio.github.io/rsconnect/
131 stars 80 forks source link

How to find which R package version should be used for shiny server deployment? #618

Closed Fred-Wu closed 1 year ago

Fred-Wu commented 1 year ago

I just started to use rsconnect in my company, and tried to deploy a shiny app from my windows machine. The server comes with R 4.1.0, and one of the packages requires to install terra.

I have tried multiple R package repos from Rstudio dev-cran with different dates to install terra, and tried version 1.2-10, 1.3-4, ... all the way to the latest version.

However, none of them was able to be uploaded, or installed during deployment. For the versions before 1.4, the error was

Uploading bundle for application: 335...Error: node stack overflow
Execution halted

while for versions above 1.4, parts of the error were

The requested URL returned error: 407
RStudio Connect cannot download a package because the R package repository (for example, CRAN or RStudio Package Manager) cannot be accessed.

This happened to other packages too, but the issue was usually resolved after I uninstalled and re-installed with a different repo. But for terra, I was not able to find a repo to fix the issue.

Any suggestions for the next step?

aronatkins commented 1 year ago

Could you explain how you are installing terra and if you are configuring the R option repos?

You should also feel free to open a support case (https://support.rstudio.com/), where we are more able to help resolve server configuration issues.

Fred-Wu commented 1 year ago

I think I have identified the source of the issue. My default repo cran is set to CSIRO, which could be accessed via company's VPN. However, this repo could not be accessed on rsconnect, and only RStudio cran is opened. After I changed my default repo to RStudio, the app's deployment works fine.

However, I do not quite understand how RStudio Packager Manger works. All packages I want are listed on the internal dev-cran, and downloadable from it, but the deployment still downloads packages from RStudio cran even I have set second repo to the internal dev-cran.

aronatkins commented 1 year ago

I am still a little unclear about your exact configuration.

If you have two defined repositories and packages are available in both, R will install from the first repository that contains the package.

If this is your situation (two repositories), you can configure repos to point only to your dev-cran:

options(repos = c(CRAN = "https://rspm.company.com/dev-cran/latest"))

If you do not see Connect downloading from your internal "dev-cran" after this change, could you open a support case (https://support.rstudio.com), as we may need details about your Connect server configuration.