gpt4 book ai didi

amazon-web-services - SocketError at/getaddrinfo : nodename nor servname provided, 或未知 padrino

转载 作者:行者123 更新时间:2023-12-05 06:45:39 35 4
gpt4 key购买 nike

我正在尝试使用 padrino 为我的亚马逊环境构建一个仪表板。但是当我在 Controller 中尝试以下代码时:

get :index, :map => "/" do
AWS.config(access_key_id: 'ACCESS_KEY',
secret_access_key: 'secret_access_key',
region: 'ap-southeast-2')
ec2 = AWS::EC2.new
response = ec2.client.describe_instances(:instance_ids => ['instance_id'])
@instance = response[:reservation_set].first[:instances_set].first
render 'index'
end

我遇到了以下错误:

SocketError - getaddrinfo: nodename nor servname provided, or not known:
/Users/mymac/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:877:in initialize'
/Users/mymac/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:877:inopen'
/Users/mymac/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:877:in block in connect'
/Users/mymac/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/timeout.rb:66:intimeout'
/Users/mymac/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:876:in connect'
/Users/mymac/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:862:indo_start'
/Users/mymac/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:857:in start'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.37.0/lib/aws/core/http/connection_pool.rb:309:instart_session'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.37.0/lib/aws/core/http/connection_pool.rb:125:in session_for'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.37.0/lib/aws/core/http/net_http_handler.rb:55:inhandle'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.37.0/lib/aws/core/client.rb:252:in block in make_sync_request'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.37.0/lib/aws/core/client.rb:288:inretry_server_errors'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.37.0/lib/aws/core/client.rb:248:in make_sync_request'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.37.0/lib/aws/core/client.rb:510:inblock (2 levels) in client_request'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.37.0/lib/aws/core/client.rb:390:in log_client_request'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.37.0/lib/aws/core/client.rb:476:inblock in client_request'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.37.0/lib/aws/core/client.rb:372:in return_or_raise'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.37.0/lib/aws/core/client.rb:475:inclient_request'
(eval):3:in describe_instances'
/Users/mymac/dev/padrino_workspace/aem_dashboard/app/controllers/aem.rb:24:inblock (2 levels) in '
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/application/routing.rb:699:in call'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/application/routing.rb:699:inblock in route'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/application/routing.rb:62:in []'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/application/routing.rb:62:inblock (3 levels) in process_destination_path'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.4/lib/sinatra/base.rb:976:in route_eval'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/application/routing.rb:62:inblock (2 levels) in process_destination_path'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/application/routing.rb:62:in catch'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/application/routing.rb:62:inblock in process_destination_path'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/application/routing.rb:37:in instance_eval'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/application/routing.rb:37:inprocess_destination_path'
(eval):20:in block in call'
(eval):9:incatch'
(eval):9:in call'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/http_router-0.11.1/lib/http_router.rb:288:inraw_call'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/http_router-0.11.1/lib/http_router.rb:142:in call'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/application/routing.rb:1101:inroute!'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/application/routing.rb:1086:in block in dispatch!'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.4/lib/sinatra/base.rb:1049:inblock in invoke'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.4/lib/sinatra/base.rb:1049:in catch'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.4/lib/sinatra/base.rb:1049:ininvoke'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/application/routing.rb:1084:in dispatch!'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.4/lib/sinatra/base.rb:889:inblock in call!'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.4/lib/sinatra/base.rb:1049:in block in invoke'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.4/lib/sinatra/base.rb:1049:incatch'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.4/lib/sinatra/base.rb:1049:in invoke'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.4/lib/sinatra/base.rb:889:incall!'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.4/lib/sinatra/base.rb:877:in call'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/sass-3.3.3/lib/sass/plugin/rack.rb:54:incall'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.2/lib/rack/protection/base.rb:50:in call'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.2/lib/rack/protection/xss_header.rb:18:incall'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.2/lib/rack/protection/base.rb:50:in call'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.2/lib/rack/protection/base.rb:50:incall'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.2/lib/rack/protection/json_csrf.rb:18:in call'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.2/lib/rack/protection/base.rb:50:incall'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.2/lib/rack/protection/base.rb:50:in call'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.2/lib/rack/protection/frame_options.rb:31:incall'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/head.rb:11:in call'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:incall'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/reloader/rack.rb:22:in call'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/logger.rb:398:incall'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.4/lib/sinatra/show_exceptions.rb:21:in call'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:225:incontext'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:220:in call'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.4/lib/sinatra/base.rb:2004:incall'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.4/lib/sinatra/base.rb:1469:in block in call'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.4/lib/sinatra/base.rb:1778:insynchronize'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.4/lib/sinatra/base.rb:1469:in call'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/router.rb:82:inblock in call'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/router.rb:75:in each'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/router.rb:75:incall'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/thin-1.6.2/lib/thin/connection.rb:86:in block in pre_process'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/thin-1.6.2/lib/thin/connection.rb:84:incatch'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/thin-1.6.2/lib/thin/connection.rb:84:in pre_process'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/thin-1.6.2/lib/thin/connection.rb:53:inprocess'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/thin-1.6.2/lib/thin/connection.rb:39:in receive_data'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:inrun_machine'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in run'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/thin-1.6.2/lib/thin/backends/base.rb:73:instart'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/thin-1.6.2/lib/thin/server.rb:162:in start'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/handler/thin.rb:16:inrun'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/server.rb:264:in start'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/server.rb:50:instart'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/server.rb:39:in start'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/server.rb:12:inrun!'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/cli/adapter.rb:7:in start'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/lib/padrino-core/cli/base.rb:32:instart'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/thor-0.17.0/lib/thor/task.rb:27:in run'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/thor-0.17.0/lib/thor/invocation.rb:120:ininvoke_task'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/thor-0.17.0/lib/thor.rb:344:in dispatch'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/thor-0.17.0/lib/thor/base.rb:434:instart'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.12.0/bin/padrino:9:in <top (required)>'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/bin/padrino:23:inload'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/bin/padrino:23:in <main>'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:ineval'
/Users/mymac/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `'

这是我的 gem 文件:

ruby '2.0.0'

gem 'rake'
gem 'thin'

gem 'bcrypt-ruby', :require => 'bcrypt'
gem 'sass'
gem 'haml'
gem 'mongoid', '~>3.0.0'

gem 'mocha', :group => 'test', :require => false
gem 'shoulda', :group => 'test'
gem 'rack-test', :require => 'rack/test', :group => 'test'

gem 'padrino', '0.12.0'
gem "bootstrap-sass", "~> 3.1.1.0"

gem 'aws-sdk', '~> 1.37.0'
gem 'rest-client', '~> 1.6.7'
gem 'net-ping', '~> 1.7.2'

如果我在 irb、sinatra 和 rails 中尝试以下代码,它运行良好:

AWS.config(access_key_id: 'ACCESS_KEY',
secret_access_key: 'secret_access_key',
region: 'ap-southeast-2')
ec2 = AWS::EC2.new
response = ec2.client.describe_instances(:instance_ids => ['instance_id'])
@instance = response[:reservation_set].first[:instances_set].first

谁能帮帮我。谢谢。

我使用的是 ruby​​ 2.0.0、padrino 0.12.0 和 OS X 10.8.2。问候强尼

最佳答案

您的区域配置可能有误。我遇到了同样的错误 when trying to access an S3 bucket .因为我的桶是美国标准的,又名“us-east-1”,这个配置最终起作用了:

AWS.config(access_key_id: 'xxx', 
secret_access_key: 'xxx',
region: 'us-west-1',
s3: { region: 'us-east-1' })

关于amazon-web-services - SocketError at/getaddrinfo : nodename nor servname provided, 或未知 padrino,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22588089/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com