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

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

Open
jzadra opened this issue May 23, 2024 · 3 comments

Comments

@jzadra
Copy link

jzadra commented May 23, 2024

Hi, I posted this under renv issues (see rstudio/renv#1903 (comment)) , 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 rstudio/renv#1903 (comment) 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:

  • pfas.shiny.golem [0.0.0.9000]
    renv may be unable to restore these packages in the future.
    Consider reinstalling these packages from a known source (e.g. CRAN).

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
Copy link

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
Copy link
Author

jzadra commented May 27, 2024

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.

@NeuroShepherd
Copy link

@jzadra I've been encountering a similar (the same?) issue in one of my projects, and I think I've finally found a solution--more detail here.

In short, you should be able to fix this by ignoring the in-development package in renv with renv::settings$ignored.packages("your_golem_app_package").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants