Paperclip, Amazon S3 Storage, the Amazon AWS-SDK gem, and Error: “No such file or directory”

So at work, we switched from using the aws-s3 gem (unofficial) to the aws-sdk gem (official), since the new paperclip gem version required it. Added a new initializer file and made a few changes in how we were opening the S3 connection. No big deal.

Until we got to the part where we were opening a remote URL, reading its contents (an MP3), and trying to save it to a file on S3. (Before you get all riled up about piracy, it’s a voice generator service that we pay for.) So after switching gems, all we got when trying to grab the remote file was:

  No such file or directory - http://www.blahblahblah...

At first I thought it might be the service, but plugging in any other url didn’t work either. Arrgh! The code didn’t change in that respect! WTH?

Yeah well, apparently something did with the gem, because putting:

  require 'open-uri'

at the top of the controller fixed it all up.

Hope this saves you some time/hair pulling/frustration.

Leave a Reply

Your email address will not be published. Required fields are marked *