Issue rendering a `.pdf` due to `.log` file

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.

options(tinytex.verbose = TRUE)

rmarkdown::render(input = "/Project_Name/rmarkdown.Rmd",
                  output_file = paste0("/Project_Name/Output/", 
                  intermediates_dir = "/home/Service_Account/store_temp_files/")
/usr/lib/rstudio-server/bin/pandoc/pandoc +RTS -K512m -RTS '/Project_Name/Output/' --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 for debugging tips.

I have TinyTex installed in a root file that may not have write permission.

> tinytex::tinytex_root()
[1] "/data/TinyTeX/.TinyTeX"

If the .log file is my issue, where are the .log files written to? How can I declare that the .log is written to a path with write permissions?

Currently, I believe the files written to create the PDF will be written to the input directory, in your case /Project_Name/

Does your account have write access to there too ? or just to the Output subfolder ?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

FWIW I opened an issue to remember and document this behavior and question it in the future

Thank you for the clarification, @cderv.

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.

@cderv has opened up an issue to question this behavior.

1 Like