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".
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.
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.
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?
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 ---. 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().
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.
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!