Question

Error on shiny-server

Posted April 18, 2020 270 views
R

I’m currently using a shiny server with Ubuntu as the operating system. I’m really new to shiny but attempted created my first survey with the hopes of collecting user inputs and writing them in a csv file.

Locally, it works (i.e. responses get saved in a local folder). However, when I developed a shiny app within my new R Studio server to test it, there is an error which reads:

"Error: cannot open the connection"

This occurs when I press the submit button. I think the error occurs because my shiny server doesn’t have rights to save files in my desired folder, i.e.

/home/my_user/test

The folder I’d save the responses would be located in that shiny folder in my new R Studio directory.

I’ve checked extensively on the website and I found:

Write permission from shiny app

Permission denied while using write.csv on ubuntu server

This is my saveData function:

saveData <- function(data) {

  fileName <- sprintf("%s_%s.csv", humanTime(), digest::digest(data))
  write.csv(x = data, file = file.path(responsesDir, fileName), row.names = FALSE, quote = TRUE)
}

The response directory (responsesDir) is

/home/my_user/test/csv_files

I’ve tried the following:

sudo chown shiny:shiny /var/shiny-server/test/

It says that there is no such file or directory.

Am I missing something very obvious? Thank you so much!

Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!