Aws-sdk-ruby: Seahorse::Client::NetworkingError SSL_connect returned=1 errno=0 state=error: certificate verify failed

Created on 2 Aug 2016  路  5Comments  路  Source: aws/aws-sdk-ruby

Hi,

I am making the dynamodb connection through

Aws.config.update({ region: region, credentials: Aws::Credentials.new(a.public.text, a.private.text), })

I am getting the error while executing the line :

Node.where(:is_submitted => 't').where(:is_signed_off => 'f').count

Error :

Seahorse::Client::NetworkingError

SSL_connect returned=1 errno=0 state=error: certificate verify failed

Logs :

/home/lakhwani/FCLaunchRequirement/env/FCLaunchRequirementWebsite-1.0/runtime/ruby1.9/1.9.1/net/http.rb:800:in connect' /home/lakhwani/FCLaunchRequirement/env/FCLaunchRequirementWebsite-1.0/runtime/ruby1.9/1.9.1/net/http.rb:800:inblock in connect'
/home/lakhwani/FCLaunchRequirement/env/FCLaunchRequirementWebsite-1.0/runtime/ruby1.9/1.9.1/timeout.rb:69:in timeout' /home/lakhwani/FCLaunchRequirement/env/FCLaunchRequirementWebsite-1.0/runtime/ruby1.9/1.9.1/timeout.rb:100:intimeout'
/home/lakhwani/FCLaunchRequirement/env/FCLaunchRequirementWebsite-1.0/runtime/ruby1.9/1.9.1/net/http.rb:800:in connect' /home/lakhwani/FCLaunchRequirement/env/FCLaunchRequirementWebsite-1.0/runtime/ruby1.9/1.9.1/net/http.rb:756:indo_start'
/home/lakhwani/FCLaunchRequirement/env/FCLaunchRequirementWebsite-1.0/runtime/ruby1.9/1.9.1/net/http.rb:751:in start' aws-sdk-core (2.3.19) lib/seahorse/client/net_http/connection_pool.rb:281:instart_session'
aws-sdk-core (2.3.19) lib/seahorse/client/net_http/connection_pool.rb:93:in session_for' aws-sdk-core (2.3.19) lib/seahorse/client/net_http/handler.rb:116:insession'
aws-sdk-core (2.3.19) lib/seahorse/client/net_http/handler.rb:68:in transmit' aws-sdk-core (2.3.19) lib/seahorse/client/net_http/handler.rb:42:incall'
aws-sdk-core (2.3.19) lib/seahorse/client/plugins/content_length.rb:12:in call' aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/dynamodb_crc32_validation.rb:27:incall'
aws-sdk-core (2.3.19) lib/aws-sdk-core/json/error_handler.rb:8:in call' aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/request_signer.rb:84:incall'
aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:87:in call' aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:118:inretry_request'
aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:101:in retry_if_possible' aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:89:incall'
aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:118:in retry_request' aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:101:inretry_if_possible'
aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:89:in call' aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:118:inretry_request'
aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:101:in retry_if_possible' aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:89:incall'
aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:118:in retry_request' aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:101:inretry_if_possible'
aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:89:in call' aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:118:inretry_request'
aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:101:in retry_if_possible' aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:89:incall'
aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:118:in retry_request' aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:101:inretry_if_possible'
aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:89:in call' aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:118:inretry_request'
aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:101:in retry_if_possible' aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:89:incall'
aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:118:in retry_request' aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:101:inretry_if_possible'
aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:89:in call' aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:118:inretry_request'
aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:101:in retry_if_possible' aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:89:incall'
aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:118:in retry_request' aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:101:inretry_if_possible'
aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/retry_errors.rb:89:in call' aws-sdk-core (2.3.19) lib/aws-sdk-core/json/handler.rb:11:incall'
aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/user_agent.rb:12:in call' aws-sdk-core (2.3.19) lib/seahorse/client/plugins/endpoint.rb:41:incall'
aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/param_validator.rb:21:in call' aws-sdk-core (2.3.19) lib/seahorse/client/plugins/raise_response_errors.rb:14:incall'
aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb:112:in call' aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/param_converter.rb:20:incall'
aws-sdk-core (2.3.19) lib/aws-sdk-core/plugins/response_paging.rb:26:in call' aws-sdk-core (2.3.19) lib/seahorse/client/plugins/response_target.rb:21:incall'
aws-sdk-core (2.3.19) lib/seahorse/client/request.rb:70:in send_request' aws-sdk-core (2.3.19) lib/seahorse/client/base.rb:207:inblock (2 levels) in define_operation_methods'
dynamoid (1.1.0) lib/dynamoid/adapter_plugin/aws_sdk_v2.rb:368:in block (2 levels) in scan' dynamoid (1.1.0) lib/dynamoid/adapter_plugin/aws_sdk_v2.rb:367:inloop'
dynamoid (1.1.0) lib/dynamoid/adapter_plugin/aws_sdk_v2.rb:367:in block in scan' dynamoid (1.1.0) lib/dynamoid/criteria/chain.rb:142:ineach'
dynamoid (1.1.0) lib/dynamoid/criteria/chain.rb:142:in each' dynamoid (1.1.0) lib/dynamoid/criteria/chain.rb:142:inblock in records_via_scan'
dynamoid (1.1.0) lib/dynamoid/criteria/chain.rb:115:in each' dynamoid (1.1.0) lib/dynamoid/criteria/chain.rb:115:ineach'
dynamoid (1.1.0) lib/dynamoid/criteria/chain.rb:115:in to_a' dynamoid (1.1.0) lib/dynamoid/criteria/chain.rb:115:inArray'
dynamoid (1.1.0) lib/dynamoid/criteria/chain.rb:115:in records' dynamoid (1.1.0) lib/dynamoid/criteria/chain.rb:95:ineach'
app/controllers/application_controller.rb:108:in count' app/controllers/application_controller.rb:108:inset_global_counts'
activesupport (4.1.14.2) lib/active_support/callbacks.rb:429:in block in make_lambda' activesupport (4.1.14.2) lib/active_support/callbacks.rb:143:incall'
activesupport (4.1.14.2) lib/active_support/callbacks.rb:143:in block in halting_and_conditional' activesupport (4.1.14.2) lib/active_support/callbacks.rb:501:incall'
activesupport (4.1.14.2) lib/active_support/callbacks.rb:501:in block in call' activesupport (4.1.14.2) lib/active_support/callbacks.rb:501:ineach'
activesupport (4.1.14.2) lib/active_support/callbacks.rb:501:in call' activesupport (4.1.14.2) lib/active_support/callbacks.rb:86:inrun_callbacks'
actionpack (4.1.14.2) lib/abstract_controller/callbacks.rb:19:in process_action' actionpack (4.1.14.2) lib/action_controller/metal/rescue.rb:29:inprocess_action'
actionpack (4.1.14.2) lib/action_controller/metal/instrumentation.rb:32:in block in process_action' activesupport (4.1.14.2) lib/active_support/notifications.rb:159:inblock in instrument'
activesupport (4.1.14.2) lib/active_support/notifications/instrumenter.rb:20:in instrument' activesupport (4.1.14.2) lib/active_support/notifications.rb:159:ininstrument'
actionpack (4.1.14.2) lib/action_controller/metal/instrumentation.rb:30:in process_action' actionpack (4.1.14.2) lib/action_controller/metal/params_wrapper.rb:250:inprocess_action'
actionpack (4.1.14.2) lib/abstract_controller/base.rb:136:in process' actionview (4.1.14.2) lib/action_view/rendering.rb:30:inprocess'
actionpack (4.1.14.2) lib/action_controller/metal.rb:196:in dispatch' actionpack (4.1.14.2) lib/action_controller/metal/rack_delegation.rb:13:indispatch'
actionpack (4.1.14.2) lib/action_controller/metal.rb:232:in block in action' actionpack (4.1.14.2) lib/action_dispatch/routing/route_set.rb:80:incall'
actionpack (4.1.14.2) lib/action_dispatch/routing/route_set.rb:80:in dispatch' actionpack (4.1.14.2) lib/action_dispatch/routing/route_set.rb:48:incall'
actionpack (4.1.14.2) lib/action_dispatch/journey/router.rb:73:in block in call' actionpack (4.1.14.2) lib/action_dispatch/journey/router.rb:59:ineach'
actionpack (4.1.14.2) lib/action_dispatch/journey/router.rb:59:in call' actionpack (4.1.14.2) lib/action_dispatch/routing/route_set.rb:690:incall'
rack (1.5.2) lib/rack/etag.rb:23:in call' rack (1.5.2) lib/rack/conditionalget.rb:25:incall'
rack (1.5.2) lib/rack/head.rb:11:in call' actionpack (4.1.14.2) lib/action_dispatch/middleware/params_parser.rb:27:incall'
actionpack (4.1.14.2) lib/action_dispatch/middleware/flash.rb:254:in call' rack (1.5.2) lib/rack/session/abstract/id.rb:225:incontext'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in call' actionpack (4.1.14.2) lib/action_dispatch/middleware/cookies.rb:562:incall'
actionpack (4.1.14.2) lib/action_dispatch/middleware/callbacks.rb:29:in block in call' activesupport (4.1.14.2) lib/active_support/callbacks.rb:82:inrun_callbacks'
actionpack (4.1.14.2) lib/action_dispatch/middleware/callbacks.rb:27:in call' actionpack (4.1.14.2) lib/action_dispatch/middleware/reloader.rb:73:incall'
actionpack (4.1.14.2) lib/action_dispatch/middleware/remote_ip.rb:76:in call' actionpack (4.1.14.2) lib/action_dispatch/middleware/debug_exceptions.rb:17:incall'
actionpack (4.1.14.2) lib/action_dispatch/middleware/show_exceptions.rb:30:in call' railties (4.1.14.2) lib/rails/rack/logger.rb:38:incall_app'
railties (4.1.14.2) lib/rails/rack/logger.rb:20:in block in call' activesupport (4.1.14.2) lib/active_support/tagged_logging.rb:68:inblock in tagged'
activesupport (4.1.14.2) lib/active_support/tagged_logging.rb:26:in tagged' activesupport (4.1.14.2) lib/active_support/tagged_logging.rb:68:intagged'
railties (4.1.14.2) lib/rails/rack/logger.rb:20:in call' /opt/brazil-pkg-cache/packages/AmazonRailsLogger/AmazonRailsLogger-4.0.80.55/RHEL5_64/DEV.STD.PTHREAD/build/ruby1.9/site_ruby/1.9.1/amazon/set_request_id.rb:9:incall'
/opt/brazil-pkg-cache/packages/AmazonRailsLogger/AmazonRailsLogger-4.0.80.55/RHEL5_64/DEV.STD.PTHREAD/build/ruby1.9/site_ruby/1.9.1/amazon/set_request_id.rb:9:in call' actionpack (4.1.14.2) lib/action_dispatch/middleware/request_id.rb:21:incall'
rack (1.5.2) lib/rack/methodoverride.rb:21:in call' rack (1.5.2) lib/rack/runtime.rb:17:incall'
activesupport (4.1.14.2) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in call' rack (1.5.2) lib/rack/lock.rb:17:incall'
actionpack (4.1.14.2) lib/action_dispatch/middleware/static.rb:84:in call' rack (1.5.2) lib/rack/sendfile.rb:112:incall'
railties (4.1.14.2) lib/rails/engine.rb:514:in call' railties (4.1.14.2) lib/rails/application.rb:144:incall'
railties (4.1.14.2) lib/rails/railtie.rb:194:in public_send' railties (4.1.14.2) lib/rails/railtie.rb:194:inmethod_missing'
rack (1.5.2) lib/rack/lint.rb:49:in _call' rack (1.5.2) lib/rack/lint.rb:37:incall'
rack (1.5.2) lib/rack/showexceptions.rb:24:in call' rack (1.5.2) lib/rack/commonlogger.rb:33:incall'
rack (1.5.2) lib/rack/chunked.rb:43:in call' rack (1.5.2) lib/rack/content_length.rb:14:incall'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in service' /home/lakhwani/FCLaunchRequirement/env/FCLaunchRequirementWebsite-1.0/runtime/ruby1.9/1.9.1/webrick/httpserver.rb:138:inservice'
/home/lakhwani/FCLaunchRequirement/env/FCLaunchRequirementWebsite-1.0/runtime/ruby1.9/1.9.1/webrick/httpserver.rb:94:in run' /home/lakhwani/FCLaunchRequirement/env/FCLaunchRequirementWebsite-1.0/runtime/ruby1.9/1.9.1/webrick/server.rb:191:inblock in start_thread'

Can any one help me in this?

guidance

Most helpful comment

What you're seeing is us wrapping errors from your HTTP client, which we then retry.

This error indicates that Ruby's OpenSSL was unable to verify the peer certificate while establishing an SSL connection to Amazon S3. This particular error is very common when your system does not have a correctly configured openssl library with certificate. For example, this happens on all Windows installations of Ruby.

As a work-around the SDK ships with an optional SSL cert bundle. Browsers frequently bundle their own certs for the same reason. You can opt-in to use the bundled cert by calling:

Aws.use_bundled_cert!

All 5 comments

What you're seeing is us wrapping errors from your HTTP client, which we then retry.

This error indicates that Ruby's OpenSSL was unable to verify the peer certificate while establishing an SSL connection to Amazon S3. This particular error is very common when your system does not have a correctly configured openssl library with certificate. For example, this happens on all Windows installations of Ruby.

As a work-around the SDK ships with an optional SSL cert bundle. Browsers frequently bundle their own certs for the same reason. You can opt-in to use the bundled cert by calling:

Aws.use_bundled_cert!

@awood45 is there another alternative to Aws.use_bundled_cert! ?

Hi,

How does one "call" Aws.use_bundled_cert!
on a Windows EC2 instance?

thank you!

@FlandersBurger I called it in aws.rb

# frozen_string_literal: true

require 'aws-sdk'

Aws.config.update(
  region: Rails.configuration.aws_region,
  credentials: Aws::Credentials.new(Rails.application.secrets.aws_access_key_id, Rails.application.secrets.aws_secret_access_key)
)

Aws.use_bundled_cert!

and that worked for me for now. this is true that I want a solution that does not require this :)
for the background, I was having SSL issue for the system before this issue that I resolved using https://github.com/rubygems/rubygems/issues/2415#issuecomment-460998632

All this start happening when I moved from Mojave to Catalina.

This can also happen if you set the region parameter to something invalid (e.g. from a typo) as this is used to generate the hostname.

Was this page helpful?
0 / 5 - 0 ratings