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

Unable to publish Shiny App to RStudio Connect #934

Closed
DEQabrits opened this issue Jul 26, 2023 · 12 comments
Closed

Unable to publish Shiny App to RStudio Connect #934

DEQabrits opened this issue Jul 26, 2023 · 12 comments

Comments

@DEQabrits
Copy link

I recently tried to update a shiny app I had published (last update was 3/7/2023) after updating to rsconnect version 1.0.1 and ran into the following error:

-- Preparing for deployment ----------------------------------------------------
v Re-deploying "shinynpdes_awqms2" to "server: rstudioconnect.deq.state.or.us / username: l_abritson"
i Looking up application with id "47"...
v Found application https://rstudioconnect.deq.state.or.us/content/09545f4b-3d21-4ad2-aff7-600e956289e9/
i Bundling 10 files: 'AlBLM_Transform.R', 'app.R', 'CalcHardness_Function.R', 'Continuous_Summary_Function.R', 'MonteCarlo.R', 'NameandFraction.R', 'NPDES_AWQMSQuery.R', 'query_cache.RData', 'query_cache_allchar.RData', and 'README.md'
i Capturing R dependencies with renv
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

I tried running options(rsconnect.packrat = TRUE) as was recommended in the package description, but it did not seem to work. Please let me know if there is more information you need, this is my first time posting an issue.

@aronatkins
Copy link
Contributor

Could you try installing the development version of renv and report back if that changes the behavior?

remotes::install_github("rstudio/renv")

Could you also try deploying from the R console to see if that provides any additional feedback?

# Unset the option so we use renv.
options(rsconnect.packrat = NULL)
rsconnect::deployApp()

You should be able to bypass the use of renv when deploying from the R console:

options(rsconnect.packrat = TRUE)
rsconnect::deployApp()

Unfortunately, that option does not appear to alert the R session that is used by the Deploy pane for push-button deployment. I have filed #935 to track the fact that the rsconnect.packrat option is not effective when using push-button deploys.

If you are still having trouble with the latest version of renv, you will need to install the previous rsconnect release until we can solve your problem.

remotes::install_version("rsconnect", "0.8.29")

Reverting rsconnect should let you use the deployment button again.

@DEQabrits
Copy link
Author

Thank you for your prompt response! I tried installing the development version of renv and it did not change the behavior. Deploying from the R console also unfortunately did not provide any additional feedback; just the same error message I received earlier (but in multiple colors). Thankfully bypassing the use of renv using the code you supplied worked and I was able to publish my updates.

I appreciate your help!

@aronatkins
Copy link
Contributor

@kevinushey & @hadley - Do you have any advice to have renv emit additional information about the preflight issue?

@DEQabrits Is there any chance that you could narrow your application into something you would be willing to share with us?

@kevinushey
Copy link
Contributor

You'll need to ensure renv.verbose = TRUE is set. It looks like that's being explicitly set to FALSE here:

old <- options(
renv.verbose = FALSE,
renv.consent = TRUE
)
defer(options(old))

@DEQabrits
Copy link
Author

@kevinushey & @hadley - Do you have any advice to have renv emit additional information about the preflight issue?

@DEQabrits Is there any chance that you could narrow your application into something you would be willing to share with us?

That application would be difficult. But I did get the same issue with another one of my applications that I can share more easily: https://github.com/OR-Dept-Environmental-Quality/FlowDataPull.

@aronatkins
Copy link
Contributor

Thanks for that project, @DEQabrits. In experimenting with it, I did uncover one type of (related) error that is not revealing much feedback. I've filed that as rstudio/renv#1607.

Could you run these commands from the R console within your original project and tell us if any details are provided?

options(renv.consent = TRUE)
deps <- renv::dependencies(getwd())
renv::snapshot(getwd(), packages = deps$Package, prompt = FALSE)

If these steps happen to create an renv.lock file, you should remove it since your project is not an renv project.

unlink("renv.lock")

@aronatkins
Copy link
Contributor

@DEQabrits - I think I figured out the problem. You have the dflowR package installed from source rather than from CRAN or GitHub. renv is not reporting this problem, but it should.

Could you try the following before deploying again?

devtools::install_github("OR-Dept-Environmental-Quality/dflowR")

Installing like this will record information about where the package came from, which renv then uses when creating its snapshot. I've filed rstudio/renv#1608 to track this problem.

@DEQabrits
Copy link
Author

@aronatkins - I ran the commands in the R console and I got a lot more details that what was originally provided. I've copied it below.

options(renv.consent = TRUE)

deps <- renv::dependencies(getwd()) Finding R package dependencies ... [10/10] Done!
renv::snapshot(getwd(), packages = deps$Package, prompt = FALSE)
The following required packages are not installed: - downlit [required by pkgdown] - httr2 [required by gh]
Consider reinstalling these packages before snapshotting the lockfile.

The following package(s) have unsatisfied dependencies:

  • devtools requires usethis (>= 2.1.6), but version 2.1.5 is installed
  • testthat requires waldo (>= 0.4.0) , but version 0.3.1 is installed
    Consider updating the required dependencies as appropriate. Error in renv_snapshot_validate_report(valid, prompt, force) : aborting snapshot due to pre-flight validation failure >

@aronatkins
Copy link
Contributor

@DEQabrits - Thanks so much for your continued involvement. It sounds like each of those problems are indeed issues that should have blocked deployment, but neither rsconnect nor renv were reporting them correctly. Would you agree with that assessment?

After installing the suggested packages and package updates, are you able to deploy?

@hadley
Copy link
Member

hadley commented Jul 27, 2023

@DEQabrits you should be able to eliminate many of those problems by either commenting out or replacing devtools with remotes on this line: https://github.com/OR-Dept-Environmental-Quality/FlowDataPull/blob/main/USGSdatapull.R#L72-L74 (and this will generally make a bundle that's much smaller to deploy)

@DEQabrits
Copy link
Author

@aronatkins - Yes, I agree with that assessment. After installing the packages/updates I was able to deploy.

@hadley Thank you for the suggestion! I plan on doing so.

lcolladotor added a commit to LieberInstitute/Visium_SPG_AD that referenced this issue Jul 28, 2023
…or message. Once I installed S4Arrays from source (aka `BiocManager::install("S4Arrays", type = "source")`), it seems like things are working ok with `renv`. At rstudio/rsconnect#934 (comment) and that thread in general, I realized that `renv` might not always give informative error messages.
@aronatkins
Copy link
Contributor

The renv-1.0.1 release contains the rstudio/renv#1608 fix; closing this issue as resolved.

Please open a new issue if you encounter other problems.

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

4 participants