RStudio Connect: Interactive Markdown with Shiny. Error: path for html_dependency not provided

I am trying to deploy a simple interactive Markdown/Shiny document on RStudio Connect. It is not a full-blown Shiny app, but a Markdown file with Shiny controls. When I deploy this document on RStudio Connect, the following error is thrown:

Error: path for html_dependency not provided

And the document fails to render. The local version runs just fine. Any ideas as to why this might be happening? Thanks.

Document code:

---
runtime: shiny
output: html_document
---
  
### Here are two Shiny widgets
  
```{r echo = FALSE}
require(shiny)
selectInput("n_breaks", label = "Number of bins:",
            choices = c(10, 20, 35, 50), selected = 20)

sliderInput("bw_adjust", label = "Bandwidth adjustment:",
            min = 0.2, max = 2, value = 1, step = 0.2)

...that build a histogram.

renderPlot({
  hist(faithful$eruptions, probability = TRUE, breaks = as.numeric(input$n_breaks),
       xlab = "Duration (minutes)", main = "Geyser eruption duration")
  
  dens <- density(faithful$eruptions, adjust = input$bw_adjust)
  lines(dens, col = "blue")
})

Thanks for the note! As a commercial customer, I want to be sure you know that you always have access to support@rstudio.com and to an account representative who will be happy to route your request as well.

That said, this is also a good forum for discussion and assistance (and maybe help for others who run into the same issue). A few things:

  • What version of Connect are you running?
  • It would probably be helpful to have a bit more information behind the error message. The below article on troubleshooting deployments should be helpful! Is this error in the logs in the server UI? In the deployment log? You can increase the verbosity of the deployment log by:

going to Tools -> Global Options -> Publishing and selecting "Show diagnostic information when publishing".

  • The app deployed fine for me, so it does not seem that this is a Connect issue.
  • Generally, it is better to use library() than require(), in most cases. Some discussion here and here if interested. I began my R coding by using require exclusively and now have switched to library for the most part.

I'm curious to see a bit more detail on the logging. This error looks like it comes up when a shiny document is hit with rmarkdown::render() instead of rmarkdown::run(), but that shouldn't be an issue b/c Connect is taking care of that.

EDIT: One last golden nugget. If all you need are inputs, you can use parameterized rmarkdown to get a really nice deployment on Connect without injecting the shiny runtime! Info on parameterized Rmd.

This takes a little bit more time than the "responsive" rendering, but you get the added benefit of history tracking, email delivery, etc.

Always good to know that this is an option :slight_smile: The code is below as a rough sketch:



---
title: "Untitled"
author: "Cole Arendt"
date: "4/16/2018"
output: html_document
params:
  bins: 
    label: "Number of bins:"
    value: 20
    input: slider
    min: 10
    max: 50
    step: 10
  bw_adjust:
    label: "Bandwidth adjustment:"
    value: 1
    input: slider
    min: 0.2
    max: 2
    step: 0.2
    
---

 
```{r echo = TRUE}
require(shiny)
n_breaks <- params$bins

bw_adjust <- params$bw_adjust
```

```{r echo=TRUE}

  hist(faithful$eruptions, probability = TRUE, breaks = as.numeric(n_breaks),
       xlab = "Duration (minutes)", main = "Geyser eruption duration")
  
  dens <- density(faithful$eruptions, adjust = bw_adjust)
  lines(dens, col = "blue")
```
1 Like

Hi Cole,

Thanks for a prompt response. We are currently evaluating RSConnect, which is why I thought starting with community support is best. I'm running:

RStudio Connect v1.6.0-9
Build "ddd9702"
Avaliable R Versions: 3.4.4
on Ubuntu.

I get the very same message in the deployment log (even without increasing verbosity) on my side

2018/04/16 14:43:09.528561256 $ echo: logi FALSE
2018/04/16 14:43:09.528647669
2018/04/16 14:43:09.721234174
2018/04/16 14:43:09.741092121 output file: /opt/rstudio-connect/mnt/tmp/RtmpBLb7gY/interactive_demo.knit.md
2018/04/16 14:43:09.741100727
2018/04/16 14:43:09.752604502 Error: path for html_dependency not provided
2018/04/16 14:43:09.753067932 Execution halted

and also on the server side when I look at the document log:

output file: /opt/rstudio-connect/mnt/tmp/RtmpBLb7gY/interactive_demo.knit.md
04/16 14:43:09.741
04/16 14:43:09.752
Error: path for html_dependency not provided
04/16 14:43:09.753
Execution halted

Is there any other information I would provide? I could also add you as user on the trial platform, if that'd help.

Kind regards,
Maxim

P.S. I'll look into parameterized Rmds. For the trial though, it is essential to evaluate the strengths and weaknesses of all kinds of context. We are very interested in interactive documents since these are the "golden middle way" in that they are less complex than regular Shiny apps yet not static as regular Markdown docs.

That's helpful, Maxim, thanks! Is there anything else in your code? Or did you provide the whole file .Rmd file above?

No, Cole, this is it.

Maybe one more tidbit that would be helpful. Can you execute sessionInfo() or, preferably, devtools::session_info() to get a picture of what versions of packages you are using?

Sure, here goes:

Session info ----------------------------------------------------------------------------
 setting  value                       
 version  R version 3.4.4 (2018-03-15)
 system   x86_64, mingw32             
 ui       RStudio (1.1.383)           
 language (EN)                        
 collate  English_United States.1252  
 tz       Europe/Paris                
 date     2018-04-18                  

Packages --------------------------------------------------------------------------------
 package    * version date       source        
 base       * 3.4.4   2018-03-15 local         
 compiler     3.4.4   2018-03-15 local         
 datasets   * 3.4.4   2018-03-15 local         
 devtools     1.13.5  2018-02-18 CRAN (R 3.4.3)
 digest       0.6.15  2018-01-28 CRAN (R 3.4.3)
 graphics   * 3.4.4   2018-03-15 local         
 grDevices  * 3.4.4   2018-03-15 local         
 htmltools    0.3.6   2017-04-28 CRAN (R 3.4.3)
 httpuv       1.3.6.2 2018-03-02 CRAN (R 3.4.3)
 memoise      1.1.0   2017-04-21 CRAN (R 3.4.4)
 methods    * 3.4.4   2018-03-15 local         
 mime         0.5     2016-07-07 CRAN (R 3.4.1)
 R6           2.2.2   2017-06-17 CRAN (R 3.4.3)
 Rcpp         0.12.16 2018-03-13 CRAN (R 3.4.4)
 rstudioapi   0.7     2017-09-07 CRAN (R 3.4.3)
 shiny      * 1.0.5   2017-08-23 CRAN (R 3.4.3)
 stats      * 3.4.4   2018-03-15 local         
 tools        3.4.4   2018-03-15 local         
 utils      * 3.4.4   2018-03-15 local         
 withr        2.1.2   2018-03-15 CRAN (R 3.4.4)
 xtable       1.8-2   2016-02-05 CRAN (R 3.4.3)
 yaml         2.1.18  2018-03-08 CRAN (R 3.4.4)

Has there been any movement on this issue? I see quite a few people who aren't on the Rstudio Connect platform having this issue (timelyportfolio seems to have been talking to Joe Cheng about it already). Would be useful to know why this is happening, as it hasn't always been the case. All I have is a single selectInput, which causes the error

output file: app.knit.md

Error: path for html_dependency not provided
Execution halted

When I comment that out the empty flexdashboard loads no problem.

> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Amazon Linux AMI 2017.03

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] htmltools_0.3.6

loaded via a namespace (and not attached):
 [1] compiler_3.4.1      backports_1.1.2     magrittr_1.5        rprojroot_1.3-2     tools_3.4.1        
 [6] flexdashboard_0.5.1 yaml_2.1.19         Rcpp_0.12.17        stringi_1.2.2       rmarkdown_1.10     
[11] knitr_1.20          jsonlite_1.5        stringr_1.3.1       digest_0.6.15       evaluate_0.10.1

We also get this error recently on RStudio Connect v1.6.10-3 for some flexdashboard with shiny runtime.

output file: /opt/rstudio-connect/mnt/tmp/RtmpEb4DZG/flexdash_classif_jours_ete.knit.md
03/07 14:35:48.403
03/07 14:35:48.415
Error: path for html_dependency not provided
03/07 14:35:48.419
Execution halted

I'm curious to see a bit more detail on the logging. This error looks like it comes up when a shiny document is hit with rmarkdown::render() instead of rmarkdown::run() , but that shouldn't be an issue b/c Connect is taking care of that.

I can reproduce this error locally if I use rmarkdown::render() instead of rmarkdown::run(). But why would RStudio Connect not pickup the runtime::shiny and use rmarkdown::run() ?

Was this document / content endpoint deployed before without the Shiny runtime? Connect does not support the ability to change content types, and so that would be one explanation. If you switched to a Shiny runtime, Connect will not respect that change. You might try deploying the asset to a new endpoint and see if that resolves!

Ok I managed to resolve this today but did not have time to post the answer until now. Your comment is very close to what happened.

The document was running in RStudio Server Pro. But when deployed, the error happened and seemed to be connected to the document type. After checking the type of content with the icon in RStudio connect, and with the API, I can say the shiny Rmd was recognized as a report and not a shiny document. I must precise runtime: shiny was indeed in the yaml from the first deployment.

After reading thoroughly the code that my colleagues wanted to deploy, I found the culprit was an empty line before the yaml that began line 2 with ---.
:package: rsconnect doesn't know how to handle that, and consider there is no yaml when trying to determine if the document is a shiny one or not. this is in the function isShinyRmd that returned FALSE even if runtime: shiny is present, because internal yamlFromRmd deals only with yaml header beginning at the first line (delim[[1]] == 1)

In my case, it was not. So yamlFromRmd returns NULL even if there is a header, and isShinyRmd returns FALSE, meaning RStudio connect considers the document to be a static one and rendering it with rmardown::render() instead of rmarkdown::run(). :smiley:

I know this well and as a precision rsconnect won't let you publish if it detects the type is different so no issue after deployment has it does not happen.

@cole hope this helps understand the issue. I don't know if it should be considered as a bug. It is really confusing for a non advanced user because document is running inside RStudio server (even if there is an empty line above the yaml header), but not running correctly on depoyment.

@autarkie you should check that your yaml header is correct and that rstudio connect detects correctly that your document is a shiny rmd. In the content main pane inside Rstudio connect you can see the icon next to your document, it should be a document like a piece of paper but with a hand inside. If not, it is a classic Rmd and rendered as so by RStudio connect, which lead to the error.

You can try republishing as a new app after checking the yaml header. rsconnect checks for runtime: shiny is the header, considering it is a correct header.

1 Like

Thanks for the thorough write-up! It does sound like there is something here for us to improve, so thanks for the detail! We will see if there is some way for us to clean up this confusing scenario!

2 Likes