rebuild failed in 2.5.0.beta7

Environment

Discourse Version: 2.5.0.beta7

Plugin Commit: GitHub - paviliondev/discourse-ratings

Other Plugins
- git clone https://github.com/discourse/docker_manager.git
- git clone GitHub - livc/discourse-rss-poster: Discourse plugin which allows RSS feeds to post to the forum
#- git clone GitHub - paviliondev/discourse-ratings
- git clone GitHub - discourse/discourse-data-explorer: SQL Queries for admins in Discourse
- git clone GitHub - discourse/discourse-solved: Allow accepted answers on topics

Steps to Reproduce

./launcher rebuild app

Example

Logs

I, [2020-06-23T18:41:04.956850 #1] INFO – : > cd /var/www/discourse && su discourse -c ‘bundle exec rake db:migrate’

rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

undefined method to_i' for ["1", "1"]:Array Did you mean? to_s to_a to_h /var/www/discourse/plugins/discourse-ratings/lib/ratings/rating.rb:16:in initialize’
/var/www/discourse/plugins/discourse-ratings/lib/ratings/rating.rb:140:in new' /var/www/discourse/plugins/discourse-ratings/lib/ratings/rating.rb:140:in block in build_list’
/var/www/discourse/plugins/discourse-ratings/lib/ratings/rating.rb:139:in map' /var/www/discourse/plugins/discourse-ratings/lib/ratings/rating.rb:139:in build_list’
/var/www/discourse/plugins/discourse-ratings/lib/ratings/rating.rb:20:in build_and_set' /var/www/discourse/plugins/discourse-ratings/db/migrate/20200520084648_add_rating_types.rb:22:in block in up’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/relation/delegation.rb:87:in each' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/relation/delegation.rb:87:in each’
/var/www/discourse/plugins/discourse-ratings/db/migrate/20200520084648_add_rating_types.rb:16:in up' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:831:in exec_migration’
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:9:in block in exec_migration' /var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in exec_migration’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:812:in block (2 levels) in migrate' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:811:in block in migrate’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:471:in with_connection' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:810:in migrate’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1002:in migrate' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1310:in block in execute_migration_in_transaction’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1361:in block in ddl_transaction' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in block in transaction’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/transaction.rb:280:in block in within_new_transaction' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in block (2 levels) in synchronize’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in handle_interrupt' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in block in synchronize’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in handle_interrupt' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in synchronize’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/transaction.rb:278:in within_new_transaction' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in transaction’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/transactions.rb:212:in transaction' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1361:in ddl_transaction’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1309:in execute_migration_in_transaction' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1281:in block in migrate_without_lock’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1280:in each' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1280:in migrate_without_lock’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1229:in block in migrate' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1382:in with_advisory_lock’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1229:in migrate' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1061:in up’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1036:in migrate' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/tasks/database_tasks.rb:238:in migrate’
/var/www/discourse/lib/tasks/db.rake:197:in block in <main>' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rake-13.0.1/exe/rake:27:in <top (required)>’
/usr/local/bin/bundle:23:in load' /usr/local/bin/bundle:23:in

Caused by:
NoMethodError: undefined method to_i' for ["1", "1"]:Array Did you mean? to_s to_a to_h /var/www/discourse/plugins/discourse-ratings/lib/ratings/rating.rb:16:in initialize’
/var/www/discourse/plugins/discourse-ratings/lib/ratings/rating.rb:140:in new' /var/www/discourse/plugins/discourse-ratings/lib/ratings/rating.rb:140:in block in build_list’
/var/www/discourse/plugins/discourse-ratings/lib/ratings/rating.rb:139:in map' /var/www/discourse/plugins/discourse-ratings/lib/ratings/rating.rb:139:in build_list’
/var/www/discourse/plugins/discourse-ratings/lib/ratings/rating.rb:20:in build_and_set' /var/www/discourse/plugins/discourse-ratings/db/migrate/20200520084648_add_rating_types.rb:22:in block in up’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/relation/delegation.rb:87:in each' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/relation/delegation.rb:87:in each’
/var/www/discourse/plugins/discourse-ratings/db/migrate/20200520084648_add_rating_types.rb:16:in up' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:831:in exec_migration’
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:9:in block in exec_migration' /var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in exec_migration’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:812:in block (2 levels) in migrate' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:811:in block in migrate’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:471:in with_connection' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:810:in migrate’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1002:in migrate' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1310:in block in execute_migration_in_transaction’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1361:in block in ddl_transaction' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in block in transaction’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/transaction.rb:280:in block in within_new_transaction' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in block (2 levels) in synchronize’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in handle_interrupt' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in block in synchronize’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in handle_interrupt' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in synchronize’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/transaction.rb:278:in within_new_transaction' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in transaction’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/transactions.rb:212:in transaction' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1361:in ddl_transaction’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1309:in execute_migration_in_transaction' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1281:in block in migrate_without_lock’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1280:in each' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1280:in migrate_without_lock’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1229:in block in migrate' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1382:in with_advisory_lock’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1229:in migrate' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1061:in up’
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/migration.rb:1036:in migrate' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/tasks/database_tasks.rb:238:in migrate’
/var/www/discourse/lib/tasks/db.rake:197:in block in <main>' /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rake-13.0.1/exe/rake:27:in <top (required)>’
/usr/local/bin/bundle:23:in load' /usr/local/bin/bundle:23:in
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I, [2020-06-23T18:41:17.263296 #1] INFO – : == 20200520084648 AddRatingTypes: migrating ===================================

I, [2020-06-23T18:41:17.269391 #1] INFO – : Terminating async processes
I, [2020-06-23T18:41:17.269492 #1] INFO – : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql
/12/bin/postmaster -D /etc/postgresql/12/main pid: 49
2020-06-23 18:41:17.269 UTC [49] LOG: received fast shutdown request
I, [2020-06-23T18:41:17.269795 #1] INFO – : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 166
166:signal-handler (1592937677) Received SIGTERM scheduling shutdown…
2020-06-23 18:41:17.275 UTC [49] LOG: aborting any active transactions
2020-06-23 18:41:17.286 UTC [49] LOG: background worker “logical replication launcher” (PID 58) exited with exit code 1
166:M 23 Jun 2020 18:41:17.292 # User requested shutdown…
166:M 23 Jun 2020 18:41:17.292 * Saving the final RDB snapshot before exiting.
2020-06-23 18:41:17.293 UTC [53] LOG: shutting down
2020-06-23 18:41:17.326 UTC [49] LOG: database system is shut down
166:M 23 Jun 2020 18:41:17.513 * DB saved on disk
166:M 23 Jun 2020 18:41:17.514 # Redis is now ready to exit, bye bye…

FAILED

Pups::ExecError: cd /var/www/discourse && su discourse -c ‘bundle exec rake db:migrate’ failed with return #<Process::Status: pid 5973 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn’
exec failed with the params {“cd”=>"$home", “hook”=>“db_migrate”, “cmd”=>[“su discourse -c ‘bundle exec rake db:migrate’”]}
10f9530d0a042d4b005adc7ec94fd04851590b5c701b789cb263963d8db69dc0
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.

More info: rebuild failed in 2.5.0.beta7 · Issue #20 · paviliondev/discourse-ratings · GitHub

I have multisite as Multisite configuration with Docker - sysadmin - Discourse Meta
I’m not sure if it’s the issue of multisite.
Now I deleted the second site.
And I removed the database of the second site the build still failed. Could you please help me?

1 Like

@angus any thoughts on this one?

Ah annoying. It’s a long story, but basically Discourse’s type-casting doesn’t always work properly and you can these “data” issues.

You need to find where this integer casting is being attempted in the plugin.rb and handle the edge case when there’s an array like this. The code will be assuing it’s a string or integer. It’s an edge case that happens occasionally with custom fields.

This is the main reason I always add model aliases for custom fields

add_to_class(:model, :field) { custom_field['field'] }
1 Like