rstudio / rsconnect

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

Suddenly unable to deploy shiny app due to renv error: aborting snapshot due to pre-flight validation failure #1078

Open jzadra opened 1 month ago

jzadra commented 1 month ago

Hi, I posted this under renv issues (see https://github.com/rstudio/renv/issues/1903#issue-2299031623) , but was directed to post it here as it is likely due to how rsconnect is calling renv when publishing to shinyapps.io

Kevin Ushey seemed to think it was because of the warning about pfas.shiny.golem, which is the shiny app/package I'm developing and publishing. It seems odd that renv would look for that package.

See https://github.com/rstudio/renv/issues/1903#issuecomment-2127937986 for the references I found in my app to the package name of the app.

=====

Today I am suddenly unable to deploy my golem shiny app to shinyapps.io. I have made minor changes to the app but nothing I'm aware of that would affect the deployment, and the app works fine locally.

I did upgrade Rstudio to the most recent version this morning.

The error provides nothing to go on for troubleshooting as far as I can see.

I should also note that I don't use renv for this project, so I'm not sure why it's running.

── Preparing for deployment ──────────────────────────────────────────────────── ✔ Re-deploying "xxx" using "server: shinyapps.io / username: xxx" ℹ Looking up application with id "xxx"... ✔ Found application ℹ Bundling 74 files: .here, .Rbuildignore, app.R, CODE_OF_CONDUCT.md, DESCRIPTION, dev/01_start.R, dev/02_dev.R, dev/03_deploy.R, dev/config_attachment.yaml, dev/run_dev.R, man/figures/README-pressure-1.png, man/mod_filter_ui.Rd, man/run_app.Rd, NAMESPACE, NEWS.md, README.md, README.Rmd, scratch/app structure reprex - cicerone.R, …, R/utils_cicerone.R, and R/utils_helpers.R ℹ Capturing R dependencies with renv The following package(s) were installed from an unknown source:

Traceback (most recent calls last): 9: rsconnect::deployApp(appDir = "~/Documents/R Projects/pfas.shiny.golem", appFileManifest = "/var/folders/mp/w8f9_2c572dfzd9nf4363_lw0000gn/T/02ae-80b4-975c-c128", account = "xxx", server = "shinyapps.io", appName = "xxx", appTitle = "xxx", launch.browser = function(url) { message("Deployment completed: ", url) }, lint = FALSE, metadata = list(asMultiple = FALSE, asStatic = FALSE)) 8: bundleApp(appName = deployment$name, appDir = appDir, appFiles = appFiles, appMetadata = appMetadata, quiet = quiet, verbose = verbose, pythonConfig = pythonConfig, image = image, envManagement = envManagement, envManagementR = envManagementR, envManagementPy = envManagementPy) 7: createAppManifest(appDir = bundleDir, appMetadata = appMetadata, users = users, pythonConfig = pythonConfig, retainPackratDirectory = TRUE, image = image, envManagement = envManagement, envManagementR = envManagementR, envManagementPy = envManagementPy, verbose = verbose, quiet = quiet) 6: bundlePackages(bundleDir = appDir, extraPackages = extraPackages, verbose = verbose, quiet = quiet) 5: computePackageDependencies(bundleDir, extraPackages, quiet = quiet, verbose = verbose) 4: snapshotRenvDependencies(bundleDir, extraPackages, verbose = verbose) 3: renv::snapshot(bundleDir, packages = deps$Package, prompt = FALSE) 2: renv_snapshot_validate_report(valid, prompt, force) 1: stop("aborting snapshot due to pre-flight validation failure") Error in renv_snapshot_validate_report(valid, prompt, force) : aborting snapshot due to pre-flight validation failure Calls: ... snapshotRenvDependencies -> -> renv_snapshot_validate_report Execution halted

Sysinfo:

MacOS 23.4.0 Rstudio: 2024.04.1+748 R: 4.3.0 Renv: 1.0.7 rsconnect: 1.2.2

mvevans89 commented 1 month ago

I ran into a similar issue and at least a temporary fix is to switch to an earlier version of rsconnect, as answered in this SO post. I tried their other proposed solution of switching to packrat for package management, but the rsconnect deploy kept using renv which had the same issue of causing an error when trying to load my shiny app (which is a package).

I would definitely be interested in a long-term solution with the rsconnect version that lets you add local packages as an exception.

jzadra commented 1 month ago

Thanks, good to know it isn't just me.

I've gotten around it temporarily by actively using renv in the project (which I can't stand, but gotta go with what works).

I did try setting the renv options to ignore my app package, but when it is called by rsconnect it does not observe that setting.