gpt4 book ai didi

ruby-on-rails - URI::InvalidURIError: 错误的 URI(不是 URI?):heroku redis 错误

转载 作者:可可西里 更新时间:2023-11-01 11:26:15 29 4
gpt4 key购买 nike

我正在尝试将我的 Rails 应用程序推送到 heroku 上,我正在使用 heroku RedisToGo 附加组件我经历过这个tutorial并完成了那里提到的所有步骤。

但是在推送 heroku 时出现此错误:

remote:        rake aborted!
remote: URI::InvalidURIError: bad URI(is not URI?):

在查看我的 heroku 日志时,我发现了这个:

2017-07-13T10:06:32.602356+00:00 app[web.1]: [4] * Min threads: 5, max threads: 5
2017-07-13T10:06:32.602356+00:00 app[web.1]: [4] * Environment: production
2017-07-13T10:06:32.602357+00:00 app[web.1]: [4] * Process workers: 2
2017-07-13T10:06:32.602360+00:00 app[web.1]: [4] * Preloading application
2017-07-13T10:06:34.988601+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/fog-1.23.0/lib/fog/rackspace/mock_data.rb:42: warning: key "name" is duplicated and overwritten on line 80
2017-07-13T10:06:36.832318+00:00 app[web.1]: BONSAI_URL not present, proceeding with Elasticsearch defaults.
2017-07-13T10:06:36.971164+00:00 app[web.1]: [4] - Worker 0 (pid: 6) booted, phase: 0
2017-07-13T10:06:36.961676+00:00 app[web.1]: [4] * Listening on tcp://0.0.0.0:53849
2017-07-13T10:06:36.961921+00:00 app[web.1]: [4] Use Ctrl-C to stop
2017-07-13T10:06:36.972915+00:00 app[web.1]: [4] - Worker 1 (pid: 16) booted, phase: 0
2017-07-13T10:06:37.547049+00:00 heroku[web.1]: State changed from starting to up
2017-07-13T10:06:39.485600+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=wewritetest.herokuapp.com request_id=244a7e11-6d89-419c-a3f1-336a044faa49 fwd="47.15.9.18" dyno=web.1 connect=2ms service=5ms status=200 bytes=188 protocol=https
2017-07-13T10:06:39.491461+00:00 heroku[router]: at=info method=GET path="/users" host=wewritetest.herokuapp.com request_id=8dfb7b62-8002-41c7-af87-4c1da888db62 fwd="47.15.9.18" dyno=web.1 connect=1ms service=81ms status=404 bytes=1789 protocol=https
2017-07-13T10:06:39.414160+00:00 app[web.1]: Started GET "/users" for 47.15.9.18 at 2017-07-13 10:06:39 +0000
2017-07-13T10:06:39.418397+00:00 app[web.1]: The PGconn, PGresult, and PGError constants are deprecated, and will be
2017-07-13T10:06:39.418400+00:00 app[web.1]:
2017-07-13T10:06:39.418399+00:00 app[web.1]: removed as of version 1.0.
2017-07-13T10:06:39.489315+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2017-07-13T10:06:39.418401+00:00 app[web.1]: You should use PG::Connection, PG::Result, and PG::Error instead, respectively.
2017-07-13T10:06:39.418402+00:00 app[web.1]:
2017-07-13T10:06:39.418403+00:00 app[web.1]: Called from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
2017-07-13T10:06:39.489314+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/users"):
2017-07-13T10:06:39.489311+00:00 app[web.1]:
2017-07-13T10:06:39.489316+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2017-07-13T10:06:39.489317+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/rack/logger.rb:38:in `call_app'
2017-07-13T10:06:39.489318+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2017-07-13T10:06:39.489317+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/rack/logger.rb:20:in `block in call'
2017-07-13T10:06:39.489320+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/methodoverride.rb:22:in `call'
2017-07-13T10:06:39.489319+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/rack/logger.rb:20:in `call'
2017-07-13T10:06:39.489318+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:26:in `tagged'
2017-07-13T10:06:39.489319+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:68:in `tagged'
2017-07-13T10:06:39.489320+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2017-07-13T10:06:39.489321+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/runtime.rb:18:in `call'
2017-07-13T10:06:39.489321+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
2017-07-13T10:06:39.489321+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in `call'
2017-07-13T10:06:39.489322+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/sendfile.rb:113:in `call'
2017-07-13T10:06:39.489322+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/ssl.rb:24:in `call'
2017-07-13T10:06:39.489323+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/engine.rb:518:in `call'
2017-07-13T10:06:39.489324+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/puma-2.16.0/lib/puma/server.rb:404:in `process_client'
2017-07-13T10:06:39.489323+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:165:in `call'
2017-07-13T10:06:39.489323+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/puma-2.16.0/lib/puma/configuration.rb:81:in `call'
2017-07-13T10:06:39.489324+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/puma-2.16.0/lib/puma/server.rb:557:in `handle_request'
2017-07-13T10:06:39.489325+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/puma-2.16.0/lib/puma/server.rb:270:in `block in run'
2017-07-13T10:06:39.489328+00:00 app[web.1]: vendor/bundle/ruby/2.3.0/gems/puma-2.16.0/lib/puma/thread_pool.rb:106:in `block in spawn_thread'
2017-07-13T10:06:39.489329+00:00 app[web.1]:
2017-07-13T10:06:39.489329+00:00 app[web.1]:
2017-07-13T10:07:59.083986+00:00 heroku[router]: at=info method=GET path="/" host=wewritetest.herokuapp.com request_id=7acdb630-76d5-4ee9-99db-1c0f3a7130f4 fwd="47.15.9.18" dyno=web.1 connect=1ms service=68ms status=200 bytes=4878 protocol=https
2017-07-13T10:07:59.012446+00:00 app[web.1]: Started GET "/" for 47.15.9.18 at 2017-07-13 10:07:59 +0000
2017-07-13T10:07:59.077548+00:00 app[web.1]: Completed 200 OK in 57ms (Views: 33.9ms | ActiveRecord: 11.5ms)
2017-07-13T10:07:59.020287+00:00 app[web.1]: Processing by DashboardsController#show as HTML
2017-07-13T10:07:59.057866+00:00 app[web.1]: Post Load (1.8ms) SELECT "posts".* FROM "posts" WHERE "posts"."featured" = $1 ORDER BY "posts"."created_at" DESC LIMIT 5 OFFSET 0 [["featured", "t"]]
2017-07-13T10:07:59.058540+00:00 app[web.1]: Rendered collection (0.0ms)
2017-07-13T10:07:59.064485+00:00 app[web.1]: Tag Load (1.5ms) SELECT "tags".* FROM "tags" WHERE "tags"."featured" = $1 [["featured", "t"]]
2017-07-13T10:07:59.067769+00:00 app[web.1]: Post Load (1.6ms) SELECT "posts".* FROM "posts" WHERE ("posts"."published_at" IS NOT NULL) ORDER BY "posts"."likes_count" DESC LIMIT 5
2017-07-13T10:07:59.068086+00:00 app[web.1]: Rendered dashboards/show.html.erb within layouts/application (23.6ms)
2017-07-13T10:07:59.073504+00:00 app[web.1]: Rendered layouts/_overlay.html.erb (2.2ms)
2017-07-13T10:07:59.075951+00:00 app[web.1]: Rendered layouts/_header.html.erb (1.9ms)
2017-07-13T10:07:59.077099+00:00 app[web.1]: Rendered layouts/_alert_messages.html.erb (0.6ms)
2017-07-13T10:07:59.794640+00:00 heroku[router]: at=info method=GET path="/assets/application-b38e762c47f2b32953146f68632ef37ebc1ebd8be9eb18cb420219fec39c0327.css" host=wewritetest.herokuapp.com request_id=16e829ba-6a43-47cf-95dd-fa6d282c1f9f fwd="47.15.9.18" dyno=web.1 connect=1ms service=2ms status=304 bytes=93 protocol=https
2017-07-13T10:08:00.291032+00:00 heroku[router]: at=info method=GET path="/assets/application-1b9ad44d594dabbaf9048cf212cb895429ce1028f1db443b4927f39808eb07af.js" host=wewritetest.herokuapp.com request_id=d11b4683-d2a5-47e2-ba49-ccc70b2d4c67 fwd="47.15.9.18" dyno=web.1 connect=1ms service=1ms status=304 bytes=93 protocol=https
2017-07-13T10:08:00.743190+00:00 heroku[router]: at=info method=GET path="/assets/stories-logo-b94c0c3ea98cf69025e1b31a0c60eca185e0800bde6fa0efac23640b9a29e484.svg" host=wewritetest.herokuapp.com request_id=486b8697-e848-4e64-85a3-00f823ad4011 fwd="47.15.9.18" dyno=web.1 connect=0ms service=1ms status=304 bytes=93 protocol=https
2017-07-13T10:08:01.648293+00:00 heroku[router]: at=info method=GET path="/assets/font-awesome/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.woff2?v=4.7.0" host=wewritetest.herokuapp.com request_id=d837dc43-d8e1-4f0b-adf9-a1ca0bd58517 fwd="47.15.9.18" dyno=web.1 connect=1ms service=1ms status=304 bytes=93 protocol=https
2017-07-13T10:08:01.759278+00:00 heroku[router]: at=info method=GET path="/assets/bootstrap/glyphicons-halflings-regular-fe185d11a49676890d47bb783312a0cda5a44c4039214094e7957b4c040ef11c.woff2" host=wewritetest.herokuapp.com request_id=173efe6e-76d8-45a8-8644-2116e8fd2a4f fwd="47.15.9.18" dyno=web.1 connect=0ms service=1ms status=304 bytes=93 protocol=https
2017-07-13T10:08:16.310163+00:00 app[web.1]: Started GET "/users/sign_in" for 47.15.9.18 at 2017-07-13 10:08:16 +0000
2017-07-13T10:08:16.317781+00:00 app[web.1]: Processing by Users::SessionsController#new as HTML
2017-07-13T10:08:16.378593+00:00 app[web.1]: Rendered devise/sessions/new.html.erb within layouts/application (11.6ms)
2017-07-13T10:08:16.380297+00:00 app[web.1]: Rendered layouts/_overlay.html.erb (0.7ms)
2017-07-13T10:08:16.381387+00:00 app[web.1]: Rendered layouts/_header.html.erb (0.8ms)
2017-07-13T10:08:16.381587+00:00 app[web.1]: Rendered layouts/_alert_messages.html.erb (0.1ms)
2017-07-13T10:08:16.381914+00:00 app[web.1]: Completed 200 OK in 64ms (Views: 20.2ms | ActiveRecord: 9.7ms)
2017-07-13T10:08:16.387929+00:00 heroku[router]: at=info method=GET path="/users/sign_in" host=wewritetest.herokuapp.com request_id=84c93151-21f7-4b08-80f7-bab12c74b7d9 fwd="47.15.9.18" dyno=web.1 connect=0ms service=74ms status=200 bytes=5606 protocol=https
2017-07-13T10:08:27.907280+00:00 app[web.1]: Started GET "/users/sign_up" for 47.15.9.18 at 2017-07-13 10:08:27 +0000
2017-07-13T10:08:27.911257+00:00 app[web.1]: The PGconn, PGresult, and PGError constants are deprecated, and will be
2017-07-13T10:08:27.911259+00:00 app[web.1]: removed as of version 1.0.
2017-07-13T10:08:27.911260+00:00 app[web.1]:
2017-07-13T10:08:27.911261+00:00 app[web.1]: You should use PG::Connection, PG::Result, and PG::Error instead, respectively.
2017-07-13T10:08:27.911262+00:00 app[web.1]:
2017-07-13T10:08:27.911263+00:00 app[web.1]: Called from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
2017-07-13T10:08:27.989221+00:00 app[web.1]: Processing by Devise::RegistrationsController#new as HTML
2017-07-13T10:08:28.054992+00:00 app[web.1]: Rendered devise/shared/_links.html.erb (3.2ms)
2017-07-13T10:08:28.055091+00:00 app[web.1]: Rendered devise/registrations/new.html.erb within layouts/application (9.4ms)
2017-07-13T10:08:28.061328+00:00 app[web.1]: Rendered layouts/_overlay.html.erb (2.1ms)
2017-07-13T10:08:28.065558+00:00 app[web.1]: Rendered layouts/_header.html.erb (3.1ms)
2017-07-13T10:08:28.067128+00:00 app[web.1]: Rendered layouts/_alert_messages.html.erb (0.9ms)
2017-07-13T10:08:28.067900+00:00 app[web.1]: Completed 200 OK in 78ms (Views: 31.7ms | ActiveRecord: 7.7ms)
2017-07-13T10:08:28.075063+00:00 heroku[router]: at=info method=GET path="/users/sign_up" host=wewritetest.herokuapp.com request_id=f3bbed4e-21e6-4ebc-9746-20ee8edd9cc3 fwd="47.15.9.18" dyno=web.1 connect=1ms service=165ms status=200 bytes=5889 protocol=https
2017-07-13T10:08:41.970884+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"hZJGNe6uzC3C0mdyX/I8xYbe2mOcvvrzxtarT/Lyu7n/nANf0BQ8XaDps8YgkQ1aIaFPjnvNsu+67yjMedKsDA==", "user"=>{"username"=>"shjd", "email"=>"djhfjhjsdj@fkdf.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Create Account"}
2017-07-13T10:08:41.966200+00:00 app[web.1]: Started POST "/users" for 47.15.9.18 at 2017-07-13 10:08:41 +0000
2017-07-13T10:08:41.970790+00:00 app[web.1]: Processing by Devise::RegistrationsController#create as HTML
2017-07-13T10:08:42.063114+00:00 app[web.1]: (1.6ms) BEGIN
2017-07-13T10:08:42.279675+00:00 heroku[router]: at=info method=POST path="/users" host=wewritetest.herokuapp.com request_id=857e195b-3984-4b2f-9f0c-8e9ce3335aad fwd="47.15.9.18" dyno=web.1 connect=1ms service=315ms status=500 bytes=1714 protocol=https
2017-07-13T10:08:42.255717+00:00 app[web.1]: User Exists (2.4ms) SELECT 1 AS one FROM "users" WHERE ("users"."id" IS NOT NULL) AND "users"."slug" = $1 LIMIT 1 [["slug", "shjd"]]
2017-07-13T10:08:42.269115+00:00 app[web.1]: (2.5ms) COMMIT
2017-07-13T10:08:42.272598+00:00 app[web.1]: Completed 500 Internal Server Error in 302ms (ActiveRecord: 11.9ms)
2017-07-13T10:08:42.259192+00:00 app[web.1]: User Exists (1.8ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'djhfjhjsdj@fkdf.com' LIMIT 1
2017-07-13T10:08:42.265647+00:00 app[web.1]: SQL (1.9ms) INSERT INTO "users" ("username", "email", "encrypted_password", "slug", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["username", "shjd"], ["email", "djhfjhjsdj@fkdf.com"], ["encrypted_password", "$2a$10$/xOPT9KJhdpXKHYbBiIIEeGYV1flaNsFRWcHWtUv3eMSvbg7IhrlG"], ["slug", "shjd"], ["created_at", "2017-07-13 10:08:42.260384"], ["updated_at", "2017-07-13 10:08:42.260384"]]
2017-07-13T10:08:42.274274+00:00 app[web.1]: app/models/concerns/searchable_user.rb:42:in `index_document'
2017-07-13T10:08:42.274271+00:00 app[web.1]:
**2017-07-13T10:08:42.274273+00:00 app[web.1]: Redis::CannotConnectError (Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)):**
2017-07-13T10:08:42.274275+00:00 app[web.1]:
2017-07-13T10:08:42.274275+00:00 app[web.1]:

我的redis.rb

uri = URI.parse(ENV["redis://redistogo:566e8c417f1d9d9041712bda66ba1048@barreleye.redistogo.com:10727/"])
REDIS = Redis.new(:url => uri)

development.rb

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false

# Do not eager load code on boot.
config.eager_load = false

# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false

# Action Mailer configuration
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :test
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }

# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log

# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load

# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true

# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true

# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
ENV["REDISTOGO_URL"] = 'redis://redistogo:566e8c417f1d9d9041712bda66ba1048@barreleye.redistogo.com:10727/'

# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true

# React configurations.
config.react.variant = :development
config.react.addons = true

config.after_initialize do
Bullet.enable = true
Bullet.alert = true
end
end

最佳答案

也许尝试安装

 gem 'figaro'

当然是“捆绑安装”。然后键入“figaro install”,application.yml 文件将在配置文件夹中生成。

在这个文件中:

REDISTOGO_URL = 'redis://redistogo:566e8c417f1d9d9041712bda66ba1048@barreleye.redistogo.com:10727/'

提交并推送 heroku 并输入:'figaro heroku:set -e production'

祝你好运

关于ruby-on-rails - URI::InvalidURIError: 错误的 URI(不是 URI?):heroku redis 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45077670/

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