Skip to content

Solid Cache breaks assets:precompile in production #267

@zedalaye

Description

@zedalaye

Trying to deploy a simple app build with Rails 8.0.2 that uses SolideQueue and SolidCache in separate SQLite databases, I get this error at the assets:precompile step (reproducable outside Docker build) :

❯ RAILS_ENV=production SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile --trace
** Invoke assets:precompile (first_time)
** Invoke environment (first_time)
** Execute environment
bin/rails aborted!
NoMethodError: undefined method 'map' for an instance of String (NoMethodError)

            { shards: databases.map(&:to_sym).index_with { |database| { writing: database } } }
                               ^^^^
Did you mean?  tap
/home/pierre/.local/share/mise/installs/ruby/3.4.3/lib/ruby/gems/3.4.0/gems/solid_cache-1.0.7/lib/solid_cache/configuration.rb:40:in 'SolidCache::Configuration#set_connects_to'
/home/pierre/.local/share/mise/installs/ruby/3.4.3/lib/ruby/gems/3.4.0/gems/solid_cache-1.0.7/lib/solid_cache/configuration.rb:14:in 'SolidCache::Configuration#initialize'

Don't really know what is relevant to share here so... here is my database.yml

# SQLite. Versions 3.8.0 and up are supported.
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem "sqlite3"
#
default: &default
  adapter: sqlite3
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

development:
  primary:
    <<: *default
    database: storage/development.sqlite3
  cache:
    <<: *default
    database: storage/development_cache.sqlite3
    migrations_paths: db/cache_migrate    
  queue:
    <<: *default
    database: storage/development_queue.sqlite3
    migrations_paths: db/queue_migrate
  cable:
    <<: *default
    database: storage/development_cable.sqlite3
    migrations_paths: db/cable_migrate

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  primary:
    <<: *default
    database: storage/test.sqlite3
  cache:
    <<: *default
    database: storage/test_cache.sqlite3
    migrations_paths: db/cache_migrate
  queue:
    <<: *default
    database: storage/test_queue.sqlite3
    migrations_paths: db/queue_migrate
  cable:
    <<: *default
    database: storage/test_cable.sqlite3
    migrations_paths: db/cable_migrate

# Store production database in the storage/ directory, which by default
# is mounted as a persistent Docker volume in config/deploy.yml.
production:
  primary:
    <<: *default
    database: storage/production.sqlite3
  cache:
    <<: *default
    database: storage/production_cache.sqlite3
    migrations_paths: db/cache_migrate
  queue:
    <<: *default
    database: storage/production_queue.sqlite3
    migrations_paths: db/queue_migrate
  cable:
    <<: *default
    database: storage/production_cable.sqlite3
    migrations_paths: db/cable_migrate

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions