I am attempting to use rmarkdown::render() with a service account to execute reporting. I am running into the following error, although I am having trouble debugging the issue. The directories specified have write access for the service account. I can see the pandoc*.tex that are created where I specified the intermediates_dir files.
/usr/lib/rstudio-server/bin/pandoc/pandoc +RTS -K512m -RTS '/Project_Name/Output/rmarkdown.utf8.md' --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output pandoc1cb562dae79.tex --self-contained --highlight-style tango --pdf-engine pdflatex --variable graphics --lua-filter /opt/R/3.6.3/lib/R/library/rmarkdown/rmd/lua/pagebreak.lua --lua-filter /opt/R/3.6.3/lib/R/library/rmarkdown/rmd/lua/latex-div.lua
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
! I cant write on file '2020-12-08_rmarkdown.log'.
(Press Enter to retry, or Control-D to exit; default file extension is '.log')
Please type another transcript file nameError: LaTeX failed to compile /Project_Name/Output/2020-12-08_rmarkdown.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips.
I have TinyTex installed in a root file that may not have write permission.
The service account dose not have write access to the input directory. I deploy my projects by cloning them from their remote repositories using sudo permissions. This prevents any user from being able to write in the file.
I will test to see if there are any issues using rmarkdown::render() with a different input file that has write-permission and provide an update.
Edit with solution:
Per @cderv, the files written to create the PDF will be written to the input directory regardless of whether the intermediate_dirs argument is provided. The solution is to make sure the account executing the rmarkdown::render() has write access to the input directory.