ThinkR-open / golem

A Framework for Building Robust Shiny Apps
https://thinkr-open.github.io/golem/
Other
914 stars 133 forks source link

[BUG] Deployment issue: Claims that the package i'm creating is not installed. #1136

Closed jzadra closed 5 months ago

jzadra commented 7 months ago

When I deploy my golem app to shinyapps.io, named "jzApp", I get the warning:

rsconnect::deployApp(
  appName = desc::desc_get_field("Package"),
  appTitle = desc::desc_get_field("Package"),
  appFiles = c(
    # Add any additional files unique to your app here.
    "R/",
    "inst/",
    #"data/",
    "NAMESPACE",
    "DESCRIPTION",
    "app.R"
  ),
  appId = rsconnect::deployments(".")$appID,
  lint = FALSE,
  forceUpdate = TRUE
)

ℹ Capturing R dependencies with renv
The following required packages are not installed:
- jzApp

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.

Is this supposed to happen or do I have something mis-configured?

Choosing Option 1 deploys, but the app does not work and gives the following errors in the log:

2024-04-01T15:47:31.123473+00:00 shinyapps[11331578]: Starting R with process ID: '75'
2024-04-01T15:47:31.128384+00:00 shinyapps[11331578]: Shiny application starting ...
2024-04-01T15:47:31.132042+00:00 shinyapps[11331578]: Warning in loadSupport(appDir, renv = sharedEnv, globalrenv = NULL) :
2024-04-01T15:47:31.135519+00:00 shinyapps[11331578]:   Loading R/ subdirectory for Shiny application, but this directory appears to contain an R package. Sourcing files in R/ may cause unexpected behavior.
2024-04-01T15:47:31.139369+00:00 shinyapps[11331578]: ℹ Loading jzApp
2024-04-01T15:47:31.984508+00:00 shinyapps[11331578]: 
2024-04-01T15:47:31.988280+00:00 shinyapps[11331578]: Listening on http://127.0.0.1:41329
2024-04-01T16:24:18.216042+00:00 shinyapps[11331578]: Container event from container-9377171: stop

Option 2 yields:

Selection: 2
Error: package 'jzApp' is not available
VincentGuyader commented 7 months ago

Hi

Can you update rsconnect and renv. Then restart ans retry ?

:)

jzadra commented 7 months ago

Both were already up to date: rsconnect @ 1.2.1 and renv @ 1.0.5

VincentGuyader commented 7 months ago

Thank you for this feedback. This is an issue we encountered some time ago, but we were unable to reproduce it with the latest versions of renv and rsconnect.

There are three avenues to explore:

1/ Try using packrat instead of renv:

options(rsconnect.packrat = TRUE)

2/ Create your own renv.lock:

remotes::install_github("thinkr-open/attachment@renv_no_desc")
attachment::create_renv_for_prod(output = "renv.lock")

Then deploy using rsconnect::deployApp().

3/ Explicitly ask renv to ignore the jzApp package:

renv::settings$ignored.packages("jzApp")

Then deploy using rsconnect::deployApp().

VincentGuyader commented 6 months ago

hi,

did you manage to deal with this issue ?

Regards

jzadra commented 6 months ago

I used #3 and it seems to be working fine.

ColinFay commented 5 months ago

closing if it's working, feel free to comment if you need the issue to be reopen :)