R Shiny app works locally, but times out when deployed on shinyapps (web scraping issue?)

Hi, I built an NBA Dashboard with shiny and everything works correctly locally, but when i deploy it on shinyapps and it tries web scraping to retrieve new data the app times out. This stack overflow post outlines the same exact issue I'm having.

Below is the code that is causing the hiccup, the game_logs function is from a package called nbastatr which extracts about ~ 20,000 rows from the nba stats API, and it takes about 10 seconds to run on my computer. But when the shinyapps server tries running it, it never completes and the app times out. I've verified this in the logs and it's the last line of code that the app attempts to execute. I've tried changing the timeout limit of the server from 60 seconds to 300 seconds and nothing changed.

devtools::install_github("abresler/nbastatR")
library(nbastatR)
game_logs(seasons = 2020)

I've searched around and cannot find any solution, and I have no idea what I could try to make it start working. If anyone has any ideas I'd appreciate it !

I'd consider separating out the process of updating data from the presentational shinyapp.
You could run a local job every day to webscrape and push changes , and your app can simply use it.

That aside is there anything special about this 'last line of code' that might explain your difficulty?

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