Here is a document you could read particularly the part on debugging.(Shiny debugging and reprex guide)