小编典典

Heroku错误:ArgumentError:无效的URI方案''

redis

我正在尝试让我的Rails应用程序通过Sidekiq处理后台作业,并将Sidekiq与Redoku上的Redis连接。这是我的Procfile

web: bundle exec puma -C config/puma.rb
worker: bundle exec -C config/sidekiq.yml

这是我的Sidekiq.rb初始化器文件:

require 'sidekiq'

Sidekiq.configure_client do |config|  
  config.redis = { url: ENV['REDIS_PROVIDER'] }
end

Sidekiq.configure_client do |config|  
   config.redis = { url: ENV['REDIS_PROVIDER'] }
end

REDIS_PROVIDER变量REDISTOGO_URL在Heroku中设置为。按照此处提供的说明,我还添加了一个初始化器文件redis.rb。这里是内容:

uri = URI.parse(ENV["REDIS_PROVIDER"])
REDIS = Redis.new(:url => uri)

我收到以下错误,不确定如何解决。Heroku也抛出H10错误

[3] ! Unable to load application: ArgumentError: invalid uri scheme '

/app/vendor/bundle/ruby/2.2.0/gems/redis-3.3.0/lib/redis/client.rb:416:in `_parse_options': invalid uri scheme '' (ArgumentError)

更新:

我在Heroku上回滚到以前的版本,并从gemfile中删除了redis gem,删除了redis
intializer文件,并且该应用程序不再崩溃。但是,后台作业仍然无法正常工作,并且我在日志中收到以下错误:

heroku/worker.1:  Starting process with command `bundle exec -C config/sidekiq.yml`
heroku/worker.1:  State changed from starting to up
app/worker.1:  bundler: command not found: -C 
heroku/worker.1:  Process exited with status 127 
heroku/worker.1:  State changed from up to crashed 
app/worker.1:  Install missing gem executables with `bundle install`

为什么系统不接受config参数导致工作程序崩溃?

无效的uri方案的错误仍然存​​在:

app/web.1:  Completed 500 Internal Server Error in 303ms (ActiveRecord: 0.0ms) 
app/web.1:  ArgumentError (invalid uri scheme ''):

sidekiq.yml文件

# Sample configuration file for Sidekiq.
# Options here can still be overridden by cmd line args.
# Place this file at config/sidekiq.yml and Sidekiq will
# pick it up automatically.
---
:verbose: false
:concurrency: 10

# Set timeout to 8 on Heroku, longer if you manage your own systems.

:超时:8

# Sidekiq will run this file through ERB when reading it so you can
# even put in dynamic logic, like a host-specific queue.
# http://www.mikeperham.com/2013/11/13/advanced-sidekiq-host-specific-queues/
:queues:
  - critical
  - default
  - low

# you can override concurrency based on environment

生产::并发:25阶段::并发:10


阅读 574

收藏
2020-06-20

共1个答案

小编典典

您使用REDIS_PROVIDER的方式不正确。请再次查看文档。

https://github.com/mperham/sidekiq/wiki/Using-Redis#using-an-env-
variable

2020-06-20