Unable to publish .rmd PDF to connect. Says first I must render it, but I have.

When I try to publish a .rmd file with pdf output to connect it says I must first render it, but I have done that.
I am using a template, but unsure how that could be affecting it. If I create a new .rmd with pdf output without using a custom template, then it is able to be published to connect.

Any insights on what could be causing this issue?

Does the template require packages for latex?
I had such problem, when I took the latex file to my latex compiler it asked to install packages, on R-studio it just returned an error saying it could not render it.

Can you add an example that would help us recreate the error?