Shiny app working on local server, but won't deploy to server due to error

My shiny server and ui scripts run fine locally. No errors or anything. When I try to deploy them to Shiny though, I keep getting the following error message:

Attaching package: ‘shinydashboard’

The following object is masked from ‘package:graphics’:


Attaching package: ‘DT’

The following objects are masked from ‘package:shiny’:

    dataTableOutput, renderDataTable

Error in value[[3L]](cond) : object 'sales_week' not found
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted

I unfortunately can't repost the entire script for privacy reasons, but I imagine that isn't a big deal. What would be the best way to debug this? I've parsed through all my scripts and I'm still not finding any stray sales_week objects that could be doing this. No errors come up when I run it locally with ShinyApp(ui,server). Is there a command I can run that will tell you "Here is the exact line causing the error"?

Does the same error happen if you run your Shiny app locally on a fresh, empty R session? See this post for a discussion how to do that

The error message is saying that R is unsuccessfully looking for the object named sales_week, probably referenced in a function call somewhere near the beginning of your app. My guess is that this object was created by you outside of the app code, and is available in your local environment now, so the app runs successfully on local. Running the app in a fresh empty R-session locally should produce the same error message you are seeing on the failed deploy.

Long term you will want to save and commit the data file(s) with your app when you deploy. The app code should have the required lines to read sales_week into memory so your Shiny functions can find and use it.

1 Like