I have an R Shiny application running on Shiny Server on an EC2 instance. The operating system is Ubuntu. The application is pushed from GitHub to the EC2 instance via GitHub Actions and CodeDeploy.
The app works correctly apart from a shiny::downloadHandler that runs rmarkdown::render to produce a Word document downloadable by the user.
There is no problem rendering & downloading this locally on my machine in development.
However, when the download button is pressed when the application is running on the EC2 instance a new tab opens but no document is available to download. The Shiny logs state:
processing file: report_template.qmd
Warning in file(con, "w") :
cannot open file 'report_template.knit.md': Permission denied
Warning: Error in file: cannot open the connection
1: runApp [/tmp/RtmpLLsUwv/R.INSTALLf0c038efa14b/shiny/R/runapp.R#388]
I have changed file permissions for the shiny-server directory that contains the application but I don't think that can work because I believe the permissions error must be in the temporary files.
I also tried the following but no luck: https://deanattali.com/2015/05/09/setup-rstudio-shiny-server-digital-ocean/#shiny-user-perms
Is there something else I need to do to give the user shiny the correct permissions?