Rails: Sidekiq unknown driver - ruby-on-rails

I have a problem using sidekiq-unique-jobs. I am trying to use this gem package. In this part it describes how to implement the middleware. But when I copy that example and install the hiredis gem, I get the following error:
sidekiq_1 | 2022-12-24T20:36:58.716Z pid=1 tid=30x INFO: Booted Rails 6.1.7 application in development environment
sidekiq_1 | 2022-12-24T20:36:58.716Z pid=1 tid=30x INFO: Running in ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux-musl]
sidekiq_1 | 2022-12-24T20:36:58.716Z pid=1 tid=30x INFO: See LICENSE and the LGPL-3.0 for licensing details.
sidekiq_1 | 2022-12-24T20:36:58.716Z pid=1 tid=30x INFO: Upgrade to Sidekiq Pro for more features and support: https://sidekiq.org
sidekiq_1 | 2022-12-24T20:36:58.718Z pid=1 tid=30x INFO: Sidekiq 7.0.2 connecting to Redis with options {:url=>"redis://redis:6379", :driver=>:hiredis, :size=>5, :pool_name=>"default"}
sidekiq_1 | Unknown driver :hiredis, expected one of: `[:ruby]`
sidekiq_1 | /usr/local/bundle/gems/redis-client-0.11.2/lib/redis_client.rb:25:in `driver'
sidekiq_1 | /usr/local/bundle/gems/redis-client-0.11.2/lib/redis_client/config.rb:52:in `initialize'
sidekiq_1 | /usr/local/bundle/gems/redis-client-0.11.2/lib/redis_client/config.rb:176:in `initialize'
sidekiq_1 | /usr/local/bundle/gems/redis-client-0.11.2/lib/redis_client.rb:138:in `new'
sidekiq_1 | /usr/local/bundle/gems/redis-client-0.11.2/lib/redis_client.rb:138:in `config'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-7.0.2/lib/sidekiq/redis_client_adapter.rb:71:in `initialize'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-7.0.2/lib/sidekiq/redis_connection.rb:21:in `new'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-7.0.2/lib/sidekiq/redis_connection.rb:21:in `create'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-7.0.2/lib/sidekiq/config.rb:132:in `new_redis_pool'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-7.0.2/lib/sidekiq/capsule.rb:77:in `local_redis_pool'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-7.0.2/lib/sidekiq/capsule.rb:71:in `redis_pool'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-7.0.2/lib/sidekiq/cli.rb:94:in `block in run'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-7.0.2/lib/sidekiq/cli.rb:93:in `each_pair'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-7.0.2/lib/sidekiq/cli.rb:93:in `run'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-7.0.2/bin/sidekiq:31:in `<top (required)>'
sidekiq_1 | /usr/local/bundle/bin/sidekiq:25:in `load'
sidekiq_1 | /usr/local/bundle/bin/sidekiq:25:in `<top (required)>'
sidekiq_1 | /usr/local/lib/ruby/3.1.0/bundler/cli/exec.rb:58:in `load'
sidekiq_1 | /usr/local/lib/ruby/3.1.0/bundler/cli/exec.rb:58:in `kernel_load'
sidekiq_1 | /usr/local/lib/ruby/3.1.0/bundler/cli/exec.rb:23:in `run'
sidekiq_1 | /usr/local/lib/ruby/3.1.0/bundler/cli.rb:486:in `exec'
sidekiq_1 | /usr/local/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
sidekiq_1 | /usr/local/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
sidekiq_1 | /usr/local/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
sidekiq_1 | /usr/local/lib/ruby/3.1.0/bundler/cli.rb:31:in `dispatch'
sidekiq_1 | /usr/local/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
sidekiq_1 | /usr/local/lib/ruby/3.1.0/bundler/cli.rb:25:in `start'
sidekiq_1 | /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.26/libexec/bundle:48:in `block in <top (required)>'
sidekiq_1 | /usr/local/lib/ruby/3.1.0/bundler/friendly_errors.rb:120:in `with_friendly_errors'
sidekiq_1 | /usr/local/lib/ruby/gems/3.1.0/gems/bundler-2.3.26/libexec/bundle:36:in `<top (required)>'
sidekiq_1 | /usr/local/bin/bundle:25:in `load'
sidekiq_1 | /usr/local/bin/bundle:25:in `<main>'
I have no idea what I should change for hiredis as driver, and to be honest, I can't find anything on the internet about this problem. This usually means that it is not that hard to get to work, but I am struggling with this for a couple hours now!
Can someone help me fix this?
Versions:
Redis: 5.0.5
Sidekiq: 7.0.2
Sidekiq-unique-jobs: 7.1.28
Hiredis: 0.6.3
Hiredis-client: 0.11.2

Without access to an actual PC, just reading a bit in the sidekiq source code ("Use the source, Luke!") it looks like Sidekiq 7 introduced the redis-client gem.
Conversely, one needs the hiredis-client gem inside ones Gemfile - see https://github.com/redis-rb/redis-client#drivers

Related

Error when trying to install devise in Ruby on Rails 7.0.0

I'm trying to install devise in the rails version I get the error of the latest version of devise
I have tried with other devise versions but it is update it to the latest,
this is the error:
/usr/local/bundle/gems/devise-4.8.0/lib/devise.rb:321:in `ref': undefined method `reference' for ActiveSupport::Dependencies:Module (NoMethodError)
web_1 | from /usr/local/bundle/gems/devise-4.8.0/lib/devise.rb:340:in `mailer='
web_1 | from /usr/local/bundle/gems/devise-4.8.0/lib/devise.rb:342:in `<module:Devise>'
web_1 | from /usr/local/bundle/gems/devise-4.8.0/lib/devise.rb:11:in `<main>'
web_1 | from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
web_1 | from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
web_1 | from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
web_1 | from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
web_1 | from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
web_1 | from /usr/local/bundle/gems/zeitwerk-2.5.0.beta3/lib/zeitwerk/kernel.rb:35:in `require'
web_1 | from /usr/local/lib/ruby/3.0.0/bundler/runtime.rb:66:in `block (2 levels) in require'
web_1 | from /usr/local/lib/ruby/3.0.0/bundler/runtime.rb:61:in `each'
web_1 | from /usr/local/lib/ruby/3.0.0/bundler/runtime.rb:61:in `block in require'
web_1 | from /usr/local/lib/ruby/3.0.0/bundler/runtime.rb:50:in `each'
web_1 | from /usr/local/lib/ruby/3.0.0/bundler/runtime.rb:50:in `require'
web_1 | from /usr/local/lib/ruby/3.0.0/bundler.rb:174:in `require'
if you could help me I'd be grateful
Source of the Error
The version of Devise you're using calls a method named reference.
https://github.com/heartcombo/devise/blob/c82e4cf47b02002b2fd7ca31d441cf1043fc634c/lib/devise.rb#L320-L323
def self.ref(arg)
ActiveSupport::Dependencies.reference(arg)
Getter.new(arg)
end
The method existed in Rails 6:
https://github.com/rails/rails/blob/6-0-stable/activesupport/lib/active_support/dependencies.rb#L651-L653
It has been removed in Rails 7:
https://github.com/rails/rails/blob/main/activesupport/lib/active_support/dependencies.rb
This line from Rails 7.0.0.alpha1 changelog explains.
Private internal classes of ActiveSupport::Dependencies have been deleted, like ActiveSupport::Dependencies::Reference, ActiveSupport::Dependencies::Blamable, and others.
https://github.com/rails/rails/blob/main/activesupport/CHANGELOG.md#rails-700alpha1-september-15-2021
Fix: Upgrade Devise
Device has released a 4.8.1 version that's compatible with Rails 7. Run bundle update devise to upgrade.
This fix fixed my bug:
gem "devise", github: "strobilomyces/devise", branch: "patch-1"
https://github.com/heartcombo/devise/pull/5397
Devise already merged the fix for this issue with rails 7 to their main branch.
Until a new version is released, you can point the devise gem to use the main branch from GitHub in your Gemfile:
gem 'devise', git: 'https://github.com/heartcombo/devise', branch: 'main'

Containerized Rails application cannot find some libraries

I have a Rails app recently upgraded to 6.1 in an alpine 14 container with ruby 3.0.1 with all required gems compiled and installed, but it won't start:
LoadError: Error loading shared library libmariadb.so.3: No such file or directory (needed by /usr/local/bundle/gems/mysql2-0.5.3/lib/mysql2/mysql2.so) - /usr/local/bundle/gems/mysql2-0.5.3/lib/mysql2/mysql2.so
The full error text:
site | LoadError: Error loading shared library libmariadb.so.3: No such file or directory (needed by /usr/local/bundle/gems/mysql2-0.5.3/lib/mysql2/mysql2.so) - /usr/local/bundle/gems/mysql2-0.5.3/lib/mysql2/mysql2.so
site | /usr/local/bundle/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
site | /usr/local/bundle/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
site | /usr/local/bundle/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
site | /usr/local/bundle/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
site | /usr/local/bundle/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
site | /usr/local/bundle/gems/activesupport-6.1.4/lib/active_support/dependencies.rb:332:in `block in require'
site | /usr/local/bundle/gems/activesupport-6.1.4/lib/active_support/dependencies.rb:299:in `load_dependency'
site | /usr/local/bundle/gems/activesupport-6.1.4/lib/active_support/dependencies.rb:332:in `require'
site | /usr/local/bundle/gems/mysql2-0.5.3/lib/mysql2.rb:36:in `<main>'
site | /usr/local/bundle/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
site | /usr/local/bundle/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
site | /usr/local/bundle/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
site | /usr/local/bundle/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
site | /usr/local/bundle/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
site | /app/config/application.rb:5:in `<top (required)>'
site | /app/Rakefile:4:in `require_relative'
site | /app/Rakefile:4:in `<top (required)>'
site | /usr/local/bin/bundle:23:in `load'
site | /usr/local/bin/bundle:23:in `<main>'
site | (See full trace by running task with --trace)
site | rake aborted!
I don't know exactly what it's trying to load and from where.
I have libmariadb.so.3 (from mariadb-connector-c) installed into /usr/lib and also linked to /usr/local/lib.
/usr/local/bundle/gems/mysql2-0.5.3/lib/mysql2/mysql2.so is also there.
I am not deleting any packages or gems before starting up and there were no errors during bundle installation.
What am I doing wrong?
I think I was able to get around this by
apk add mariadb-dev
Hopefully that helps someone else!

No such file or directory # rb_sysopen - tmp/pids/puma.pid

I'm trying to start puma, but at the last step it fails like this:
16:38:09 web.1 | /home/ramonpm/.rvm/gems/ruby-2.2.7/gems/puma-3.9.1/lib/puma/launcher.rb:130:in `initialize': No such file or directory # rb_sysopen - tmp/pids/puma.pid (Errno::ENOENT)
16:38:09 web.1 | from /home/ramonpm/.rvm/gems/ruby-2.2.7/gems/puma-3.9.1/lib/puma/launcher.rb:130:in `open'
16:38:09 web.1 | from /home/ramonpm/.rvm/gems/ruby-2.2.7/gems/puma-3.9.1/lib/puma/launcher.rb:130:in `write_pid'
16:38:09 web.1 | from /home/ramonpm/.rvm/gems/ruby-2.2.7/gems/puma-3.9.1/lib/puma/launcher.rb:103:in `write_state'
16:38:09 web.1 | from /home/ramonpm/.rvm/gems/ruby-2.2.7/gems/puma-3.9.1/lib/puma/single.rb:92:in `run'
16:38:09 web.1 | from /home/ramonpm/.rvm/gems/ruby-2.2.7/gems/puma-3.9.1/lib/puma/launcher.rb:174:in `run'
16:38:09 web.1 | from /home/ramonpm/.rvm/gems/ruby-2.2.7/gems/puma-3.9.1/lib/puma/cli.rb:77:in `run'
16:38:09 web.1 | from /home/ramonpm/.rvm/gems/ruby-2.2.7/gems/puma-3.9.1/bin/puma:10:in `<top (required)>'
16:38:09 web.1 | from /home/ramonpm/.rvm/gems/ruby-2.2.7/bin/puma:23:in `load'
16:38:09 web.1 | from /home/ramonpm/.rvm/gems/ruby-2.2.7/bin/puma:23:in `<main>'
16:38:09 web.1 | from /home/ramonpm/.rvm/gems/ruby-2.2.7/bin/ruby_executable_hooks:15:in `eval'
16:38:09 web.1 | from /home/ramonpm/.rvm/gems/ruby-2.2.7/bin/ruby_executable_hooks:15:in `<main>'
16:38:09 web.1 | exited with code 1
16:38:09 system | sending SIGTERM to all processes
Couldn't find a solution somewhere else, they are all related to different things.
Could solve it manually creating the necessary folders, then the server process could create the pid file.
mkdir -p tmp/pids
This error happened when I first added puma.rb file by rails app:update to rails 5.2 for a Heroku app.
# Specifies the `pidfile` that Puma will use.
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
Resolved by adding tmp/pids/.keep file,
$ touch tmp/pids/.keep
And updating .gitignore file as follows.
# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep
# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep
You can add that in your config/puma.rb:
require "fileutils"
FileUtils.mkdir_p("tmp/pids")

Sidekiq jobs aren't firing in development mode, only in production

Edit: I was just told by our team that docker is not even used for production. So it seems the issue is limited to Docker and not the environments that Rails is launching into.
I have a project I'm working on sidekiq jobs seem to run fine in our production environment, but in my local development machine I get a bunch of console errors for sidekiq and I'm not sure why.
Here are my sidekiq errors:
sidekiq_1 | 2017-03-15T17:16:24.346Z 1 TID-gq075lic0 INFO: Booting Sidekiq 4.2.3 with redis options {:url=>"redis://redis:6379/"}
sidekiq_1 | 2017-03-15T17:16:25.240Z 1 TID-gq075lic0 INFO: Running in ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
sidekiq_1 | 2017-03-15T17:16:25.240Z 1 TID-gq075lic0 INFO: See LICENSE and the LGPL-3.0 for licensing details.
sidekiq_1 | 2017-03-15T17:16:25.241Z 1 TID-gq075lic0 INFO: Upgrade to Sidekiq Pro for more features and support: http://sidekiq.org
sidekiq_1 | 2017-03-15T17:16:25.260Z 1 TID-gq075lic0 INFO: Loading Schedule
sidekiq_1 | 2017-03-15T17:16:25.260Z 1 TID-gq075lic0 INFO: Schedule empty! Set Sidekiq.schedule
sidekiq_1 | 2017-03-15T17:16:25.264Z 1 TID-gq075lic0 INFO: Schedules Loaded
sidekiq_1 | 2017-03-15T17:16:25.266Z 1 TID-gq075lic0 WARN: {"context":"Exception during Sidekiq lifecycle event.","event":"startup"}
sidekiq_1 | 2017-03-15T17:16:25.266Z 1 TID-gq075lic0 WARN: TypeError: can't dup NilClass
sidekiq_1 | 2017-03-15T17:16:25.267Z 1 TID-gq075lic0 WARN: /usr/local/bundle/gems/sidekiq-scheduler-2.0.19/lib/sidekiq-scheduler/schedule.rb:126:in `dup'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-scheduler-2.0.19/lib/sidekiq-scheduler/schedule.rb:126:in `block in prepare_schedule'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-scheduler-2.0.19/lib/sidekiq-scheduler/schedule.rb:125:in `each'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-scheduler-2.0.19/lib/sidekiq-scheduler/schedule.rb:125:in `prepare_schedule'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-scheduler-2.0.19/lib/sidekiq-scheduler/schedule.rb:40:in `schedule='
sidekiq_1 | /gathrly/config/initializers/scheduler.rb:5:in `block (2 levels) in <top (required)>'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-4.2.3/lib/sidekiq/util.rb:54:in `block in fire_event'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-4.2.3/lib/sidekiq/util.rb:52:in `each'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-4.2.3/lib/sidekiq/util.rb:52:in `fire_event'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-4.2.3/lib/sidekiq/cli.rb:79:in `run'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-4.2.3/bin/sidekiq:12:in `<top (required)>'
sidekiq_1 | /usr/local/bundle/bin/sidekiq:17:in `load'
sidekiq_1 | /usr/local/bundle/bin/sidekiq:17:in `<top (required)>'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:74:in `load'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:74:in `kernel_load'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:27:in `run'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/cli.rb:335:in `exec'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/cli.rb:20:in `dispatch'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/cli.rb:11:in `start'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/exe/bundle:32:in `block in <top (required)>'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/exe/bundle:24:in `<top (required)>'
sidekiq_1 | /usr/local/bundle/bin/bundle:22:in `load'
sidekiq_1 | /usr/local/bundle/bin/bundle:22:in `<main>'
sidekiq_1 | 2017-03-15T17:16:25.268Z 1 TID-gq075lic0 INFO: Starting processing, hit Ctrl-C to stop
web_1 | Puma starting in single mode...
web_1 | * Version 3.6.0 (ruby 2.3.1-p112), codename: Sleepy Sunday Serenity
web_1 | * Min threads: 5, max threads: 5
web_1 | * Environment: development
web_1 | * Listening on tcp://0.0.0.0:3000
It says:
sidekiq_1 | 2017-03-15T17:16:25.260Z 1 TID-gq075lic0 INFO: Loading Schedule
sidekiq_1 | 2017-03-15T17:16:25.260Z 1 TID-gq075lic0 INFO: Schedule empty! Set Sidekiq.schedule
sidekiq_1 | 2017-03-15T17:16:25.264Z 1 TID-gq075lic0 INFO: Schedules Loaded
But then I get a NilClass error.
Here is my scheduler.rb file:
require 'sidekiq/scheduler'
Sidekiq.configure_server do |config|
config.on(:startup) do
Sidekiq.schedule = YAML.load_file(File.expand_path('../../sidekiq_scheduler.yml', __FILE__))
Sidekiq::Scheduler.reload_schedule!
end
end
and my sidekiq-scheduler.rb file:
UpdateEventbriteJob:
cron: "*/15 * * * *"
UpdateMeetupJob:
cron: "*/15 * * * *"
PostEventEmailJob:
# cron: "0 9 * * *"
# cron: "*/1 * * * *"
UpdateStatusJob:
cron: "*/1 * * * *" # Every minute for testing. Plan on every 24 hours
I'm testing the UpdateStatusJob locally. The other jobs working production and seem to work fine. But Nothing in this scheduler ever fires in develop mode. I would like to test the job out before I kick it up to production. What am I doing wrong?
I should also note I'm running things in docker. Something I don't use too often so I'm not sure if that's impeding things.
Here is the relevant information in my docker-compose file:
version: '2'
services:
...
sidekiq:
build: .
command: bundle exec sidekiq -C config/sidekiq.yml
env_file: .env
links:
- db
- redis
...
In the scheduler.yml PostEventEmailJob doesn't have any values, only commented out lines.
If you change the file to:
UpdateEventbriteJob:
cron: "*/15 * * * *"
UpdateMeetupJob:
cron: "*/15 * * * *"
PostEventEmailJob:
cron: "0 9 * * *"
UpdateStatusJob:
cron: "*/1 * * * *" # Every minute for testing. Plan on every 24 hours
it will parse correctly and start Sidekiq.

how to fix /.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 17, col 9: ` adapter: mysql2' (ArgumentError)

I'm trying to run the rails console on Appfog by following this document. I set up my database.yml as described, but when I run RAILS_ENV=proxied-appfog rails console I'm getting this error:
/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 22, col 9: ` adapter: mysql2' (ArgumentError)
from /.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/yaml.rb:133:in `load'
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/railties-3.2.13/lib/rails/application/configuration.rb:115:in `database_configuration'
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/activerecord-3.2.13/lib/active_record/railtie.rb:78
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:26:in `on_load'
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:25:in `each'
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:25:in `on_load'
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/activerecord-3.2.13/lib/active_record/railtie.rb:74
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `run_initializers'
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `send'
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /development/baking_journal/config/environment.rb:5
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/railties-3.2.13/lib/rails/application.rb:103:in `require_environment!'
from /.rvm/gems/ruby-1.8.7-p352#journal/gems/railties-3.2.13/lib/rails/commands.rb:40
from script/rails:6:in `require'
from script/rails:6
First of all I don't want to touch anything in rvm... but I did open that file to see what the problem was since it gave me a line number. That line contains no code. So I'm beyond confused. Whats the problem here? The only thing I can imagine is that maybe it doesn't support my version of ruby? but if you type in af runtimes the list returned is:
+---------+-------------+---------+
| Name | Description | Version |
+---------+-------------+---------+
| python2 | | 2.7.3 |
| node08 | | 0.8.14 |
| php | | 5.3.10 |
| java | | 1.7.0 |
| ruby18 | | 1.8.7 |
| ruby192 | | 1.9.2 |
| ruby193 | | 1.9.3 |
| node04 | | 0.4.12 |
| node06 | | 0.6.17 |
+---------+-------------+---------+
Any ideas?
Also, if I try to af update with the new database.yml and proxied-appfog.rb environment file, I'm not able to start the server anymore. So this error is given to me before I push my changes to the server.
Can you post your database.yml file verbatim? You probably have a syntax error in it, whitespace-related. YAML is whitespace-sensitive.
Double check your YML file for errant spaces. Indent sub-levels with two spaces rather than tabs.

Resources