Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1073777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:02:05+00:00 2026-05-16T21:02:05+00:00

I am getting a AWS::S3::NoConnectionEstablished exception when trying to download a file using paperclip

  • 0

I am getting a AWS::S3::NoConnectionEstablished exception when trying to download a file using paperclip + s3. I can fire up s3sh and create a connection just fine with the s3 credentials in my config. What is the best next step I can take to debug this issue? This is what my model looks like:

has_attached_file :file,
                    :storage => :s3,
                    :s3_permssions => :private,
                    :path => lambda { |attachment| ":id_partition/:basename.:extension" },
                    :url => lambda { |attachment| "products/:id/:basename.:extension" },
                    :s3_credentials => "#{Rails.root}/config/amazon_s3.yml",
                    :bucket => "products.mycompany.com"

And the error occurs here:

def temporary_s3_url(options={})
    options.reverse_merge! :expires_in => 10.minutes #, :use_ssl => true
    hard_url = AWS::S3::S3Object.url_for file.path, file.options[:bucket], options
    # Use our vanity URL
 hard_url.gsub("http://s3.amazonaws.com/products.mycompany.com","http://products.mycompany.com")
  end

I tried hard coding a connection as the first line in the temporary_s3_url method but I get a “bucket not found” error. I think the problem is definitely that paperclip is having a problem initializing my s3 configuration.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T21:02:05+00:00Added an answer on May 16, 2026 at 9:02 pm

    Remember that storing to S3 is not dependable–the connection can be lost, the store fail before completing, etc.

    I created my own library routines that attempt to do the store, but catch various errors. For the no connection error, I reconnect. For other storage errors, I retry (up to three times). You may also want to wait a second between retries.

    Added

    Below is the library routine I use for AWS calls.

    You’d need to add/modify the rescue clauses to catch the errors that you’re experiencing. Your connection_reset and error reporting methods will also be specific to your sw.

    # Usage example:
    # aws_repeat("Storing #{bucket}/#{obj}"){
    #   AWS::S3::S3Object.store(obj, data, bucket, opt)}    
    
    def aws_repeat(description = nil)
      # Calls the block up to 3 times, allowing for AWS connection reset problems
      for i in 1..3
        begin
          yield
        rescue Errno::ECONNRESET => e
          ok = false
          ActiveRecord::Base.logger.error \
               "AWS::S3 *** Errno::ECONNRESET => sleeping"
          sleep(1)
          if i == 1
            # reset connection
            connect_to_aws # re-login in to AWS
            ActiveRecord::Base.logger.error \
               "AWS::S3 *** Errno::ECONNRESET => reset connection"
          end        
        else
          ok = true
          break
        end
      end
    
      unless ok
        msg = "AWS::S3 *** FAILURE #{description.to_s}"
        ActiveRecord::Base.logger.error msg
        security_log(msg)
      end
    
      ok
    end
    
    ############################################
    ############################################
    
    def connect_to_aws
      # load params. Cache at class (app) level 
      @@s3_config_path ||= RAILS_ROOT + '/config/amazon_s3.yml'
      @@s3_config ||= 
           YAML.load_file(@@s3_config_path)[ENV['RAILS_ENV']].symbolize_keys
    
      AWS::S3::Base.establish_connection!(
        :access_key_id     => @@s3_config[:access_key_id],
        :secret_access_key => @@s3_config[:secret_access_key],
        :server            => @@s3_config[:server],
        :port              => @@s3_config[:port],
        :use_ssl           => @@s3_config[:use_ssl],
        :persistent        => false # from http://www.ruby-forum.com/topic/110842
        )
    
      true 
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting the following error when trying to upload an image using paperclip
Getting a strange error when trying to insert data into an Access database using
I'm trying to start a Amazon EC2 cloud machine with [startInstance][2] method using aws-sdk
I'm trying to migrate from a Nexus maven repo to using https://github.com/jcaddel/maven-s3-wagon . Getting
I’ve used Uploadify and paperclip in Rails3 and I’m getting this error - AWS::S3::NoSuchBucket
I'm trying to install acts_as_ferret in windows7.But am getting an error Using acts-as-taggable-on (2.1.1)
using the SDK, I can create a queue and get the queue list -
I'm using AWS IAM STS (via boto) to create credentials for my accessing an
I'm currently trying to configure Paperclip with newest aws-sdk suggested gem. On my S3.yml
Getting extremely confused with an adminhtml module i'm trying to write! Effectively I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.