Closed Ibrokhimsadikov closed 4 years ago
hi @Ibrokhimsadikov, thx for reporting this. I just tried to reproduce but aside from the fact, that in your ui_export_report
there is a typo, a file called SDC-report.html
is correctly created. I think you need to save that file somewhere and use shiny::downloadButton()
if you want to download it.
also, i could not reproduce the "app disconnected" error you mentioned on a fully updated R 4.0.2 system.
could you please tell us, how/where you deploy this?
Thank you so much @bernhard-da for reply to my question. I am new to shiny and thus I am having trouble to incorporate Downloadbutton with report() function of SDCMicro. I am not sure on how to call downloadbutton with report() in server as file path is already specified in report(). Please help if you can
When I ran the sample code above I am getting this error on deployed shinyapp.io, may be because of the reason getwd() is in report()
Main Question is how to call downloadhandler in server with report()
hi @Ibrokhimsadikov i really think your issue has nothing to do with sdcMicro as the report is correctly generated. the following should however work inside your server-function.
output$myRepDownload <- shiny::downloadHandler(
filename = function() {
paste0("sdcreport-", Sys.Date(), ".html")
},
content = function(file) {
sdcMicro::report(
sdcObj,
outdir = tempdir(),
filename = "tmp",
title = "SDC-Report",
internal = TRUE,
verbose = FALSE
)
f_tmp <- file.path(tempdir(), "tmp.html")
on.exit(file.remove(f_tmp))
file.copy(from = f_tmp, to = file)
}
)
Thank you so much @bernhard-da, for your help and code you shared it was very helpful to integrate downloadhandler, and it is working locally good but still getting same error while deploying app in rsconnect or shinyapps.io
Here is the logs
Thank you @bernhard-da, Is it bug?
no, not really a bug.
i think rmarkdown::render()
(which is used in sdcMicro::report()
) writes auxiliary files by default in the current dir; when deploying via rstudio-connect it might be that the default is to try to write in the current directory wich seems to be read-only. i have made some updates in https://github.com/sdcTools/sdcMicro/commit/49e80dc9558e890f86ce370b72d997b5b73c85e1 which i will probably merge soon into master and which will end up in the next cran version; i set parameter intermediates_dir
to tempdir()
which solved the issue for me (under rstudio-connect)
Thank you @bernhard-da quick response, So if I download package directly from github through devtools, will it be possible. Or it will work out once you merge it to master.
Thanks once again for your support and patience
depends; you would need to install the version with the fix in rstudio-connect (which could take a while); better wait for an updated cran-version.
Sure @bernhard-da immense thanks for your support, look forward to new changes, hope it will solve the problem
Dear @bernhard-da , I hope you are good. If you remember we had issue rendering internal report when app is deployed on rsconnect or shinyapp.io. I wanted to know whether new version of package is released with this new modification, if not when we can expect release in the future.
Thank you
There was no recent release of sdcMicro on CRAN. However, you can install the development version of this package with
remotes::install_github("sdcTools/sdcMicro")
This should also work with shinyapps.io as far as I can tell.
Thank you for prompt reply @GregorDeCillia
Dear SDCMicro team and users,
I am having trouble to generate report on my shiny app using report() function in SdcMicro. It is working fine on my local pc, but once I deploy my app it is not generating report and shiny app Disconnected from the server.
Sample code: