0

When trying to upload a csv file on our system I'm getting the folllowing error:

Errno::ENOENT: No such file or directory @ rb_sysopen - /tmp/RackMultipart20191126-93-k4s94s.csv

The code works fine locally but fails intermittently fails on production.

I'm not sure how I debug this, for example how would I view the /tmp/ directory on Heroku?

Falko
  • 995
  • 11
  • 21
  • 1
    try this [link](https://stackoverflow.com/questions/18552937/store-file-in-directory-tmp-on-heroku-rails) – Aman Relan Nov 26 '19 at 12:16
  • What are you doing with the uploaded file? The created tempfile is only available during the request handling of the upload. After that request you would parsed/stored the csv somewhere else. Is it failing during the handling of the upload or afterwards? – nathanvda Nov 26 '19 at 13:00
  • We just use the file for the duration of the request. The problem is that its intermittently failing – Falko Nov 26 '19 at 13:39

1 Answers1

1

Heroku uses ephemeral filesystem (link1,link2) which might be causing this issue.

For debugging, you could rescue for system calls exception and log the contents of tmp directory with timestamps of last modified. This could help in getting to know if the tmp folder was cleaned during the execution of your code.

shaivik
  • 323
  • 2
  • 8