rstudio / rsconnect

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

renv prevents from deploying to RStudio Connect with an uninformative error #943

Closed audricvigier closed 11 months ago

audricvigier commented 11 months ago

Hi,

I am developing Shiny apps using the golem package, and currently with R 4.2.3 . Before using that R version, I was working with rsconnect 0.16.0 to deploy, but now with 1.0.0 version, which caused the deploys to be impossible because it was using the package renv. My MWE is the Shiny app that is generated upon creating a new golem project, and then executing golem::add_rstudioconnect_file(), and then hitting the blue button to deploy. The deploy worked with R 4.1.2 and rsconnect 0.16.0, but not with R 4.2.3 rsconnect 1.0.0, I had the following error (I blanked out the server name):

-- Preparing for deployment ----------------------------------------------------
v Deploying "reprex" to "server: <server_name> / username: audricvigier"
i Creating application on server...
v Created application with id 257
i Bundling 18 files: '.here', '.Rbuildignore', 'app.R', 'DESCRIPTION', 'dev/01_start.R', 'dev/02_dev.R', 'dev/03_deploy.R', 'dev/config_attachment.yaml', 'dev/run_dev.R', 'inst/app/www/favicon.ico', 'inst/golem-config.yml', 'man/run_app.Rd', 'NAMESPACE', 'R/_disable_autoload.R', 'R/app_config.R', 'R/app_server.R', 'R/app_ui.R', and 'R/run_app.R'
i Capturing R dependencies with renv
- Operation canceled.
Execution halted

I just lost a full day to understand what was causing it, and it turns out it was renv, which was thinking wrongly the Shiny app I was trying to deploy (which is also a package as it is a golem, available locally only at this stage) was coming from CRAN. As suggested here , using options(rsconnect.packrat = TRUE) prior to deploying solved everything. Can you make the error informative to suggest the use of packrat for people working with rsconnect and/or local packages? Or use packrat as the default option, rather than renv?

hadley commented 11 months ago

We have a fix for this in the dev version of renv, but unfortunately can't submit to CRAN because they are still on vacation.

audricvigier commented 11 months ago

Thanks, I can confirm the error is very informative in today's dev version (branch main commit 5fb52fe )

aronatkins commented 11 months ago

renv-1.0.1 has been released. Please open a new issue if you continue to have problems.