Warning: Error in readRDS: error reading from connection

Hi,

I'm working on a new Shiny app, the main process in the app is to connect twitter API and use some of the twitter packages (e.g. rtweet, twitteR).
The app is working fine locally (when I ran it through the R), however, when I publish it the following error is shown:
"error reading from connection"
When I read the logs I see this error:
"Warning: Error in readRDS: error reading from connection"

Can anyone help here? what am I missing?

Thanks,
Sharon

It's hard to know the reason without seen any code, are you using readRDS in your app to read a file with an absolute path? How are you storing your API credentials? Have in minde that the app is being deployed to a different computer and absolute paths are not going to be the same.

Hi,

This is the server code, above you can see the API credential:

library(rsconnect)
library(botcheck)
library(shiny)
library(twitteR)
library(rtweet)

consumerKey = "z5ZaOVsPXY■■■■OFgHk6x8jyk"
consumerSecret = "egeAAhrwPPEhBlkhjDhg6ogOkLOKhbTqRFsiT9YnDcOhmxUAg1"
accessToken = "1058770910574985218-V4qaZtUAtH4OHwdXxbnvOnjoE5QUBf"
accessSecret = "HkD3Mp2wXIYHe1m8OlpZYwYC8ncZAkRcI9wnkf6WxCaIL"
my_oauth <- setup_twitter_oauth(consumer_key = consumerKey, consumer_secret = consumerSecret,
access_token = accessToken, access_secret = accessSecret)

options(shiny.sanitize.errors = FALSE)

shinyServer(
function(input,output){

##---------------Get Score-------------------------------------
user<-reactive({lookup_users(input$screen_name)})
output$bot_score<- renderText(botcheck(input$screen_name))

##---------------Details tab-------------------------------------

output$ProfileImage<-renderText({c('<img src="',user()$profile_image_url,'">')})
output$out_screen_name<-renderText(input$screen_name)
output$Display_name<-renderText(user()$name)
output$Description<-renderText(user()$description)
output$Location<-renderText(user()$location)
output$Protected<-renderText(user()$protected)
output$Followers<-renderText(user()$followers_count)
output$Following<-renderText(user()$friends_count)
output$Lists<-renderText(user()$listed_count)
output$Likes<-renderText(user()$favourites_count)
output$TweetsandRetweets<-renderText(user()$statuses_count)
output$LastModified<-renderText(as.character(user()$created_at))
output$Language<-renderText(user()$lang)

output$plot<-renderPlot({hist(ts_plot(get_timeline(input$screen_name, n = 3200), "hours"))})

}
)

This topic was automatically closed 21 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.