shinylive in Quarto document with reactive data source

,

I want to load a data file for a shinylive-r without user input. My demo code works fine in a Shiny app, but not in shinylive-r.

Here is my Shiny app code:

library(shiny)

ui <- fluidPage(
    tableOutput("data"),
)

server <- function(input, output, session) {

    fileData <- reactiveFileReader(
        intervalMillis = 1000, NULL,
        filePath = 'https://github.com/petzi53/learning-shiny/raw/refs/heads/master/data/products.tsv',
        readFunc = vroom::vroom, show_col_types = FALSE
       )

    output$data <- renderTable({
        head(fileData())
    })
}

shinyApp(ui, server)
#> 
#> Listening on http://127.0.0.1:6881

Created on 2025-07-04 with reprex v2.1.1

I used a file URL because I believe that it is not possible to reference local files with shinylive.

And here is my shinylive-r code chunk:

---
title: "Test shinylive reactiveFileReader "
format: html
filters: 
    - shinylive
---


```{shinylive-r}
#| standalone: true
#| viewerHeight: 550
#| components: [editor, viewer]


## file apps.R
{{< include test-shinylive-reactive-file/app.R >}}

```

The result is a blank screen with the error message:

Error: cannot open the connection to 'https://github.com/petzi53/learning-shiny/raw/refs/heads/master/data/products.tsv'. See the Javascript console for further information

Any idea what is wrong? Help is very much appreciated.

Firstly, this isn't specific to Quarto as it doesn't run in the shinylive editor either. I suspect it's related to how {vroom} opens URLs - it has a dependency on {curl} which isn't available in webR and it might well rely on that to download files via a URL. I can open a file fine using the same method but read.table() instead of vroom::vroom() (which I think uses download.file() instead of {curl}), so if you can convert your data to a file format that read.table() can handle, it should work. I'm a bit confused why you need reactiveFileReader() in the first place though - it's normally used when a file is being frequently updated.

Your answer was beneficial and helped me to find the problem. However, it is not correct, as shinylive is working with both {vroom} and {readr}.

The problem was my URL: I used as file path 'https://github.com/petzi53/…' instead of the correct URL 'https://raw.githubusercontent.com/petzi53/…'.

And now comes the peculiar thing: The Shiny app worked using {vroom} with my 'github.com' URL, but shinylive did not. There is a second anomaly: I emphasized my because it worked with my (wrong) URL but not with yours.

But whatever the reason for the second oddity, the main problem was my wrong URL.
I apologize for my mistake and thank you for your patience.

As the problem is solved, I will close this post.

PS.: You are right to be confused with my using of reactiveFileReader(). It was a desperate move after trying different options for several hours. I thought that the problem had to do with reactivity.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.