rstudio / rsconnect

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

Deployment error when repo name contains a comma #397

Closed jmcphers closed 1 year ago

jmcphers commented 4 years ago

Repro

  1. Create a new application
  2. Set the following repo option:
options(repos = c(
  `CRAN` = "https://cran.rstudio.com/",
  `Oregon State University` = "https://ftp.osuosl.org/pub/cran/",
  `University of California, Berkeley` = "https://cran.cnr.berkeley.edu/"
))
  1. Deploy the application using deployApp in the R console

Observe

Error. Traceback:

9.
lapply(X = X, FUN = FUN, ...) 
8.
sapply(repos, "[[", 2) at dependencies.R#71
7.
setNames(sapply(repos, "[[", 2), sapply(repos, "[[", 1)) at dependencies.R#71
6.
snapshotDependencies(appDir, inferDependencies(appMode, hasParameters, 
    python, hasPythonRmd)) at bundle.R#547
5.
createAppManifest(appDir = bundleDir, appMode = appMode, contentCategory = contentCategory, 
    hasParameters = hasParameters, appPrimaryDoc = appPrimaryDoc, 
    assetTypeName = assetTypeName, users = users, python = python, 
    hasPythonRmd = hasPythonRmd) at bundle.R#211
4.
bundleApp(target$appName, appDir, appFiles, appPrimaryDoc, assetTypeName, 
    contentCategory, verbose, python) at deployApp.R#356
3.
force(code) at utils.R#53
2.
withStatus(paste0("Uploading bundle for ", assetTypeName, ": ", 
    application$id), {
    python <- getPythonForTarget(python, accountDetails)
    bundlePath <- bundleApp(target$appName, appDir, appFiles,  ... at deployApp.R#351
1.
rsconnect::deployApp(appName = "shiiiiny", account = "jonathan") 

Expect

App deploys successfully

Details

Probably happens because we use commas to delimit repos in the lockfile.

https://github.com/rstudio/rsconnect/blob/050a7f7cb533bc1c689a631d64458aabeb23f807/R/dependencies.R#L68-L74

jmcphers commented 4 years ago

Caused upstream by https://github.com/rstudio/packrat/issues/587 -- because of the way Packrat writes out repos, the comma is ambiguous (could be a record separator or a repo name). We could "fix" this here by making some assumptions (e.g. presume that a repro with no = was generated from a comma and try to stitch it back together) but would be better to fix upstream.

kevinushey commented 4 years ago

Is this high priority? The workaround at least would be simple (don't include commas in your repository names).

Also worth saying that renv handles this since the lockfile format is just JSON.

jmcphers commented 4 years ago

We should have an issue open to consider moving to renv for this package (and Connect).

hadley commented 1 year ago

Closing, since we're tracking in packrat.