Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] can't deploy on posit Connect with {rsconnect} >=1.0.1 (from {packrat} to {renv}) #1070

Closed
VincentGuyader opened this issue Jul 25, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@VincentGuyader
Copy link
Member

The new version of {rsconnect} (version 1.0.1) appears to use {renv} instead of {packrat} for deploying on Connect (an shinyapps.io ?). This seems promising, but currently, it is not compatible with the approach used by {golem} to deploy the Shiny application.

The error message is as follows:

[2023-07-25 08:07:11.268878] Generate manifest.json
ℹ Bundling 17 files: '.here', '.Rbuildignore', 'app.R', 'DESCRIPTION', 'dev/01_start.R', 'dev/02_dev.R', 'dev/03_deploy.R', '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'
ℹ Capturing R dependencies with renv
- Operation canceled.
Execution halted

The solution is to pass this parameter

options(rsconnect.packrat = TRUE)

and use the following command

rsconnect::deployApp()

. For now, it is not possible to use the blue deployment button (unless the 'options' parameter is set to a very low level in the Rstudio configuration).

We are working on improving this behavior

@VincentGuyader VincentGuyader added the bug Something isn't working label Jul 25, 2023
@VincentGuyader
Copy link
Member Author

VincentGuyader commented Jul 26, 2023

I made some test. with rsconnect 1.0.1 and 1.0.1.900 (from github), and renv > 1.0.0

TL;DR

option 1 :

golem::add_rstudioconnect_file()
options(rsconnect.packrat = TRUE)
rsconnect::deployApp() #rsconnect 1.0.1

option 2 :

options(rsconnect.packrat = FALSE)
# remotes::install_github("rstudio/rsconnect")#rsconnect 1.0.1.9000
golem::add_rstudioconnect_file()
attachment::create_renv_for_prod(output = "renv.lock")
rsconnect::deployApp() #rsconnect 1.0.1.9000
# TEST 1

golem::add_rstudioconnect_file()
rsconnect::deployApp() #rsconnect 1.0.1
# Capturing R dependencies with renv
# What do you want to do?
#
#   1: Snapshot, just using the currently installed packages.
# 2: Install the packages, then snapshot.
# 3: Cancel, and resolve the situation on your own.
# Selection: 1
# ✔ Found 104 dependencies
# Error in `createAppManifest()`:
#   ! All packages must be installed from a reproducible location.
# ✖ Can't re-install packages installed from source: Rcpp, cpp11, digest, downlit, fs, jsonlite, openssl, pkgload,
#   processx, remotes, renv, rmarkdown, rsconnect, rstudioapi, sass, shiny, testthat, usethis, and xml2.
# ℹ See `rsconnect::appDependencies()` for more details.
# Run `rlang::last_trace()` to see where the error occurred.


rsconnect::deployApp()
# ── Preparing for deployment ───────────────────────────────────────────────────────────────────────────────────────────
# ✔ Re-deploying "effacemoi1" to "server: connect / username: vincent"
# ℹ Looking up application with id "592"...
# ✔ Found application <https://connect.thinkr.fr/content/bf0eb602-ca10-48da-8b01-4dbeccdf8713/>
#   ℹ Bundling 17 files: .here, .Rbuildignore, app.R, DESCRIPTION, dev/01_start.R, dev/02_dev.R, dev/03_deploy.R, 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
# ℹ Capturing R dependencies with renv
# What do you want to do?
#
#   1: Snapshot, just using the currently installed packages.
# 2: Install the packages, then snapshot.
# 3: Cancel, and resolve the situation on your own.
#
# Selection: 2
# Error: package 'effacemoi1' is not available

# TEST 2
golem::add_rstudioconnect_file()
attachment::create_renv_for_prod(output = "renv.lock")
rsconnect::deployApp() #rsconnect 1.0.1

# SAME as TEST 1

# TEST 3
golem::add_rstudioconnect_file()
options(rsconnect.packrat = TRUE)
rsconnect::deployApp() #rsconnect 1.0.1

# OK.

# TEST 4
options(rsconnect.packrat = FALSE)
# devtools::install_github("rstudio/rsconnect")
golem::add_rstudioconnect_file()
attachment::create_renv_for_prod(output = "renv.lock")
rsconnect::deployApp() #rsconnect 1.0.1.9000

# OK

# TEST 5
options(rsconnect.packrat = FALSE)
# devtools::install_github("rstudio/rsconnect")
golem::add_rstudioconnect_file()
unlink("renv.lock")
# attachment::create_renv_for_prod(output = "renv.lock")
rsconnect::deployApp() #rsconnect 1.0.1.9000

# Ok but seem to use packrat ??

# R.home(): /opt/R/4.3.1/lib/R
# Using user agent string: 'RStudio R (4.3.1 x86_64-pc-linux-gnu x86_64 linux-gnu)'
# # Validating R library read / write permissions --------------------------------
# Using R library for packrat bootstrap: /opt/rstudio-connect/mnt/R/4.3.1
# # Validating managed packrat installation --------------------------------------
# Vendored packrat archive: /opt/rstudio-connect/ext/R/packrat_0.9.0_e618feb05b78828b1cafebe8f8fb411d51a7b495.tar.gz
# Vendored packrat SHA: e618feb05b78828b1cafebe8f8fb411d51a7b495

@VincentGuyader
Copy link
Member Author

cant reproduce now with current {rsconnect} + {revn} versions.

we can close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants