rstudio / rsconnect

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

Do not ignore the `renv` folder by default #520

Closed ColinFay closed 1 year ago

ColinFay commented 3 years ago

Note: I'm not sure if it's a {rsconnect} or {renv} issue, @kevinushey feel free to correct me if you think this feature should be in {renv} instead.

If I create a new {shiny} app, use renv::init(), then do rsconnect::deployApp(), it will fail.

The reason behind this is that the .Rprofile contains a call to source("renv/activate.R"), and by default, clicking on the blue button in RStudio sends all the files except renv/ & renv.lock (so does rsconnect::deployApp().

Also, trying to include the renv/ folder by hand will fail:

> rsconnect::deployApp(appFiles = c("app.R", "renv/", "renv.lock", ".Rprofile"))
The following potential problems were identified in the project files:

The following lines contain calls to the browseURL function:
72: | `file_show("path")`                         | `browseURL("path")`               | `open path`                       |

The following lines contain calls to the browseURL function:
58: browseURL("http://localhost:9454/")

Remove browseURL calls; browseURL does not work in deployed applications.
Do you want to proceed with deployment? [Y/n]: Y
Preparing to deploy application...
Update application currently deployed at
https://colinfay.shinyapps.io/renvtest/? [Y/n] Y
DONE
Uploading bundle for application: 4258497...Error: Unable to retrieve package records for the following packages:
- 'foo', 'testRcppClass', 'testRcppInterfaceExporter', 'testRcppInterfaceUser', 'testRcppModule'
In addition: There were 50 or more warnings (use warnings() to see the first 50)

Possible solution :

That being said, maybe you have a better workflow here.

I'm deploying apps on Connect from Git, that we locally build using {renv}, and that would be nice to have them both work flawlessly without tweaking the .Rprofile :)

Cheers, Colin

hadley commented 1 year ago

It looks like the code already exists to do this (https://github.com/rstudio/rsconnect/commit/31d518b255c6080145271107d8193be5b8d38f63). But it seems like it existed at the time you filed the issue, so I'll do a little exploration.