gpt4 book ai didi

ruby-on-rails - Bonsai-Elasticsearch在Heroku生产URI::InvalidURIError中崩溃

转载 作者:行者123 更新时间:2023-12-03 01:52:13 25 4
gpt4 key购买 nike

我终于得到了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):怎么了
我已经遍历了 here的所有内容,并且查看了此 on the URI error,但由于相同的原因,我的应用程序仍然崩溃。

我的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查看所有应用程序的环境变量。

关于ruby-on-rails - Bonsai-Elasticsearch在Heroku生产URI::InvalidURIError中崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39458529/

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