Unable to run a shiny app with rtweet on a server

Viewed 35

I am having the following issue. I want to publish a shiny app that uses rtweet package. I managed to run the app on my local machine but I get an error message "Error detecting locale: Error in read.table(file = file, header = header, sep = sep, quote = quote: incomplete final line found by 'readTableHeader' in 'raw'" when I try to publish it. A minimal example:

library(shiny)
library(rtweet)

ui <- fluidPage(
    textOutput("tweet")
)

server <- function(input, output) {
  
  output$tweet <- renderText({
    tweets <- get_timeline(user = "JoeBiden", n = 1)
    tweets$full_text[1]
  })

}

shinyApp(ui = ui, server = server)

I tried running the createTokenNoBrowser function from here as suggested elsewhere but that didn't work (I got 403 Twitter API error). I also tried using rtweet_user(), rtweet_bot(), and rtweet_app() but that didn't work either.

Ideally, I would like to run the app on the server without the need to include the keys in the code explicitly for security reasons (as suggested here) but I am happy with any solution that just allows the app to run on the server. Any help would be much appreciated!

0 Answers
Related