簡體   English   中英

Bonsai-Elasticsearch在Heroku生產URI :: InvalidURIError中崩潰

[英]Bonsai-Elasticsearch crashing in Heroku Production URI::InvalidURIError

我終於得到了elasticsearch不會在啟動時崩潰我的應用程序,但是無論何時我嘗試搜索該應用程序崩潰並添加新記錄都會使該應用程序崩潰(但確實會添加該記錄)。

我收到的錯誤消息是:

 Professor Store (0.9ms)  {"id":59,"exception":["URI::InvalidURIError","bad URI(is not URI?): http://heroku config:0"]}
2016-09-12T16:48:34.008480+00:00 app[web.1]: Completed 500 Internal Server Error in 14ms (Searchkick: 0.9ms | ActiveRecord: 7.6ms | Elasticsearch: 0.0ms)
2016-09-12T16:48:34.009289+00:00 app[web.1]: 
2016-09-12T16:48:34.009290+00:00 app[web.1]: URI::InvalidURIError (bad URI(is not URI?): http://heroku config:0):
2016-09-12T16:48:34.009291+00:00 app[web.1]:   app/controllers/professors_controller.rb:51:in `block in create'
2016-09-12T16:48:34.009291+00:00 app[web.1]:   app/controllers/professors_controller.rb:50:in `create'

我不確定URI::InvalidURIError (bad URI(is not URI?): http://heroku config:0):我已經在這里進行了所有操作,並且已經在URI上進行了研究錯誤,並且由於相同原因我的應用仍然崩潰。

我的Bonsai.rb看起來像:`BONSAI_URL = ENV ['beech-6556653.us-east-1.bonsai.io']

if BONSAI_URL
  uri = URI.parse(ENV['beech-6556653.us-east-1.bonsai.io'])
Searchkick.client = Elasticsearch::Client.new({
  url:BONSAI_URL,
  log: true
  })
end

我的Professor.rb模型具有searchkick:

class Professor < ActiveRecord::Base
  searchkick
  belongs_to :user
  has_many :reviews

最后,我的gemfile:

 source 'https://rubygems.org'
ruby '2.3.1'
    # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
    gem 'rails', '4.2.5.1'
    # Use SCSS for stylesheets
    gem 'sass-rails', '~> 5.0'
    # Use Uglifier as compressor for JavaScript assets
    gem 'uglifier', '>= 1.3.0'
    # Use CoffeeScript for .coffee assets and views
    gem 'coffee-rails', '~> 4.1.0'
    #bcrypt for for encrpytion
    gem 'bcrypt', '~> 3.1', '>= 3.1.11'
    #byebug
    gem 'byebug', '~> 9.0', '>= 9.0.5'
    # Use jquery as the JavaScript library
    gem 'jquery-rails'
    # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
    gem 'turbolinks'
    # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
    gem 'jbuilder', '~> 2.0'
    # bundle exec rake doc:rails generates the API under doc/api.
    gem 'sdoc', '~> 0.4.0', group: :doc
    #paperclip for easy upload management
    gem 'paperclip', '~> 4.3', '>= 4.3.6'
    #bootstrap-sass
    gem 'bootstrap-sass', '~> 3.3', '>= 3.3.6'
    #searchkick
    gem 'searchkick', '~> 1.2', '>= 1.2.1'
    #paginate
    gem 'will_paginate', '~> 3.1'
    #paginate for bootstrap
    gem 'bootstrap-will_paginate', '~> 0.0.10'
    #rmagick
    gem 'rmagick', '~> 2.15', '>= 2.15.4'
    #Carrierwave
    gem 'carrierwave'
    #Cloudinary
    gem 'cloudinary'
    #Paperclip forcloudinary
    gem 'paperclip-cloudinary'

此行是不必要的:

uri = URI.parse(ENV['beech-6556653.us-east-1.bonsai.io'])

尤其是因為未為ENV分配值。 您可以在終端中使用heroku config:get查看應用程序的所有環境變量。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM