Ok I managed to resolve this today but did not have time to post the answer until now. Your comment is very close to what happened.
The document was running in RStudio Server Pro. But when deployed, the error happened and seemed to be connected to the document type. After checking the type of content with the icon in RStudio connect, and with the API, I can say the shiny Rmd was recognized as a report and not a shiny document. I must precise runtime: shiny was indeed in the yaml from the first deployment.
After reading thoroughly the code that my colleagues wanted to deploy, I found the culprit was an empty line before the yaml that began line 2 with ---.
rsconnect doesn't know how to handle that, and consider there is no yaml when trying to determine if the document is a shiny one or not. this is in the function isShinyRmd that returned FALSE even if runtime: shiny is present, because internal yamlFromRmd deals only with yaml header beginning at the first line (delim[[1]] == 1)
In my case, it was not. So yamlFromRmd returns NULL even if there is a header, and isShinyRmd returns FALSE, meaning RStudio connect considers the document to be a static one and rendering it with rmardown::render() instead of rmarkdown::run(). 
I know this well and as a precision rsconnect won't let you publish if it detects the type is different so no issue after deployment has it does not happen.
@cole hope this helps understand the issue. I don't know if it should be considered as a bug. It is really confusing for a non advanced user because document is running inside RStudio server (even if there is an empty line above the yaml header), but not running correctly on depoyment.
@autarkie you should check that your yaml header is correct and that rstudio connect detects correctly that your document is a shiny rmd. In the content main pane inside Rstudio connect you can see the icon next to your document, it should be a document like a piece of paper but with a hand inside. If not, it is a classic Rmd and rendered as so by RStudio connect, which lead to the error.
You can try republishing as a new app after checking the yaml header. rsconnect checks for runtime: shiny is the header, considering it is a correct header.