rstudio / rsconnect

Publish Shiny Applications, RMarkdown Documents, Jupyter Notebooks, Plumber APIs, and more

Home Page:http://rstudio.github.io/rsconnect/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

deployment to Posit Connect: undefined columns selected

tyner opened this issue · comments

Apologies if I am barking up the wrong tree, but figured I'd start here. Here is the deployment log (with some censoring of potentially sensitive info). If the root cause is that shiny is not installed, perhaps it could halt the deployment earlier in the process?

── Preparing for deployment ────────────────────────────────────────────────────
✔ Re-deploying "censored" using "server: censored / username: censored"
ℹ Looking up application with id "7"...
✔ Found application <censored>
ℹ Bundling 1 file: 'app.R'
ℹ Capturing R dependencies with renv
The following required packages are not installed:
- shiny
Packages must first be installed before renv can snapshot them.
Use `renv::dependencies()` to see where this package is used in your project.

✔ Found 0 dependencies
✔ Created 768b bundle
ℹ Uploading bundle...
✔ Uploaded bundle with id 12
── Deploying to server ─────────────────────────────────────────────────────────
Building Shiny application...
Bundle created with R version 4.3.2 is compatible with environment Local with R version 4.2.3 from /opt/R/4.2.3/bin/R 
Bundle requested R version 4.3.2; using /opt/R/4.2.3/bin/R which has version 4.2.3
Performing manifest.json to packrat transformation.
[rsc-session] Content GUID: c0f46806-27d3-4959-8159-a475c695eea8
[rsc-session] Content ID: 7
[rsc-session] Bundle ID: 12
[rsc-session] Job Key: ewZNchJp9oNoxkVz
Running on host: censored
Linux distribution: Amazon Linux release 2 (Karoo)
Running as user: uid=191(rstudio-connect) gid=154(rstudio-connect) groups=154(rstudio-connect) context=system_u:system_r:unconfined_service_t:s0
Connect version: 2023.09.0
LANG: en_US.UTF-8
Working directory: /opt/rstudio-connect/mnt/app
Using R 4.2.3
R.home(): /opt/R/4.2.3/lib/R
Using user agent string: 'RStudio R (4.2.3 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.2.3
# Validating managed packrat installation --------------------------------------
Vendored packrat archive: /opt/rstudio-connect/ext/R/packrat_0.9.1-1_ac6bc33bce3869513cbe1ce14a697dfa807d9c41.tar.gz
Vendored packrat SHA: ac6bc33bce3869513cbe1ce14a697dfa807d9c41
Managed packrat SHA:  ac6bc33bce3869513cbe1ce14a697dfa807d9c41
Managed packrat version: 0.9.1.1
Managed packrat is up-to-date.
# Validating packrat cache read / write permissions ----------------------------
Using packrat cache directory: /opt/rstudio-connect/mnt/packrat/4.2.3
# Setting packrat options and preparing lockfile -------------------------------
Error in `[.data.frame`(lockInfo, , "Package") : 
  undefined columns selected
Calls: <Anonymous> -> <Anonymous> -> [ -> [.data.frame
Execution halted
Build error: exit status 1
── Deployment complete ─────────────────────────────────────────────────────────
✖ Deployment failed with error: exit status 1

Here is my local sessionInfo()

R version 4.3.2 (2023-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default


locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8    LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                           LC_TIME=English_United States.utf8    

time zone: America/New_York
tzcode source: internal

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

loaded via a namespace (and not attached):
 [1] compiler_4.3.2    cli_3.6.2         rsconnect_1.2.1   tools_4.3.2       rstudioapi_0.15.0 curl_5.2.0        box_1.1.3        
 [8] jsonlite_1.8.8    digest_0.6.34     lifecycle_1.0.4   openssl_2.1.1     rlang_1.1.3       askpass_1.2.0

The important detail from the deployment log:

ℹ Capturing R dependencies with renv
The following required packages are not installed:
- shiny
Packages must first be installed before renv can snapshot them.
Use `renv::dependencies()` to see where this package is used in your project.

✔ Found 0 dependencies

renv did detect that shiny is not installed, but the lack of that package was not a problem.

When run interactively, rsconnect::writeManifest() and rsconnect::deployApp() present a prompt:

> rsconnect::writeManifest()
ℹ Capturing R dependencies with renv
The following required packages are not installed:
- shiny
Packages must first be installed before renv can snapshot them.
Use `renv::dependencies()` to see where this package is used in your project.

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:

When run in a non-interactive context (such as using the deploy button in RStudio), that prompt is not provided and no error occurs.

Something has changed with renv, as we previously saw an error during deployment. Example from renv: rstudio/renv#1607 (comment)

With rstudio/renv#1370, it appears that the default behavior snapshots the installed packages, while it would previously cancel in a non-interactive context.

@kevinushey - was this aspect intentional? Could we have renv:::renv_snapshot_report_missing() default to "cancel" or otherwise provide some option of producing an error during deployment-time dependency scanning?