canvas:compile_assets error

eagleJong
Community Member

Now I have modified some *.handlerbars files at canvas lms source code and tried to apply it, but failed.
I tried to execute this command:


bundle exec rake canvas:compile_assets


And it failed with this errors:


rake aborted!
BrandableCSS::DefaultMD5NotUpToDateError:
Something has changed about the default variables or images used in the Theme Editor.
If you are seeing this and you did not make changes to either app/stylesheets/brandable_variables.json
or one of the images it references, it probably meeans your local setup is out of date.

First, make sure you run rake db:migrate
and then run ./script/nuke_node.sh

If that does not resolve the issue, it probably means you did update one of those json variables
in app/stylesheets/brandable_variables.json or one of the images it references so you need to rename
the db migrations that makes sure when this change is deployed or checked out by anyone else
makes a new .css file for the css variables for each brand based on these new defaults.
To do that, run this command and then restart your rails process. (for local dev, if you want the
changes to show up in the ui, make sure you also run rake db:migrate afterwards).

ONLY DO THIS IF YOU REALLY DID MEAN TO MAKE A CHANGE TO THE DEFAULT BRANDING STUFF:

mv db/migrate/_regenerate_brand_files_based_on_new_defaults_predeploy.rb
db/migrate/29801541086306_regenerate_brand_files_based_on_new_defaults_predeploy.rb
&&
mv db/migrate/
_regenerate_brand_files_based_on_new_defaults_postdeploy.rb
db/migrate/29801541086307_regenerate_brand_files_based_on_new_defaults_postdeploy.rb

FYI, current variables are: {"ic-brand-primary"=>"#008EE2", "ic-brand-font-color-dark"=>"#2D3B45", "ic-link-color"=>"#008EE2", "ic-brand-button--primary-bgd"=>"$ic-brand-primary", "ic-brand-button--primary-text"=>"#ffffff", "ic-brand-button--secondary-bgd"=>"#2D3B45", "ic-brand-button--secondary-text"=>"#ffffff", "ic-brand-global-nav-bgd"=>"#394B58", "ic-brand-global-nav-ic-icon-svg-fill"=>"#ffffff", "ic-brand-global-nav-ic-icon-svg-fill--active"=>"$ic-brand-primary", "ic-brand-global-nav-menu-item__text-color"=>"#ffffff", "ic-brand-global-nav-menu-item__text-color--active"=>"$ic-link-color", "ic-brand-global-nav-avatar-border"=>"#ffffff", "ic-brand-global-nav-menu-item__badge-bgd"=>"$ic-brand-primary", "ic-brand-global-nav-menu-item__badge-text"=>"#ffffff", "ic-brand-global-nav-logo-bgd"=>"#394B58", "ic-brand-header-image"=>"/dist/images/canvas_logomark_only@2x-e197434829.png", "ic-brand-mobile-global-nav-logo"=>"/dist/images/mobile-global-nav-logo-aff8453309.svg", "ic-brand-watermark"=>"", "ic-brand-watermark-opacity"=>"1.0", "ic-brand-favicon"=>"/dist/images/favicon-ef3f24b471.ico", "ic-brand-apple-touch-icon"=>"/dist/images/apple-touch-icon-585e5d997d.png", "ic-brand-msapplication-tile-color"=>"$ic-brand-primary", "ic-brand-msapplication-tile-square"=>"/dist/images/windows-tile-eda8889e7b.png", "ic-brand-msapplication-tile-wide"=>"/dist/images/windows-tile-wide-44d3cc1060.png", "ic-brand-right-sidebar-logo"=>"", "ic-brand-Login-body-bgd-color"=>"#394B58", "ic-brand-Login-body-bgd-image"=>"", "ic-brand-Login-body-bgd-shadow-color"=>"#2D3B45", "ic-brand-Login-logo"=>"/dist/images/login/canvas-logo-5617606953.svg", "ic-brand-Login-Content-bgd-color"=>"none", "ic-brand-Login-Content-border-color"=>"none", "ic-brand-Login-Content-inner-bgd"=>"none", "ic-brand-Login-Content-inner-border"=>"none", "ic-brand-Login-Content-inner-body-bgd"=>"none", "ic-brand-Login-Content-inner-body-border"=>"none", "ic-brand-Login-Content-label-text-color"=>"#ffffff", "ic-brand-Login-Content-password-text-color"=>"#ffffff", "ic-brand-Login-footer-link-color"=>"#ffffff", "ic-brand-Login-footer-link-color-hover"=>"#ffffff", "ic-brand-Login-instructure-logo"=>"#ffffff"}
/var/canvas/lib/brandable_css.rb:139:in block in check_if_we_need_to_create_a_db_migration' /var/canvas/lib/brandable_css.rb:134:in each'
/var/canvas/lib/brandable_css.rb:134:in check_if_we_need_to_create_a_db_migration' /var/canvas/lib/brandable_css.rb:151:in default_variables_md5'
/var/canvas/app/models/brand_config.rb:146:in block (2 levels) in <class:BrandConfig>' /var/canvas/app/models/brand_config.rb:150:in block (2 levels) in class:BrandConfig'
/var/canvas/app/models/brand_config.rb:172:in save_all_files!' /var/canvas/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/relation/batches.rb:70:in block (2 levels) in find_each'
/var/canvas/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/relation/batches.rb:70:in each' /var/canvas/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/relation/batches.rb:70:in block in find_each'
/var/canvas/config/initializers/active_record.rb:890:in block in find_in_batches_with_copy' /var/canvas/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/abstract_adapter.rb:581:in block (2 levels) in log'
/var/canvas/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/abstract_adapter.rb:580:in block in log' /var/canvas/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.4/lib/active_support/notifications/instrumenter.rb:23:in instrument'
/var/canvas/vendor/bundle/ruby/2.6.0/gems/switchman-1.15.2/lib/switchman/sharded_instrumenter.rb:20:in instrument' /var/canvas/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/abstract_adapter.rb:571:in log'
/var/canvas/vendor/bundle/ruby/2.6.0/gems/switchman-1.15.2/lib/switchman/active_record/abstract_adapter.rb:37:in log' /var/canvas/config/initializers/active_record.rb:847:in find_in_batches_with_copy'
/var/canvas/config/initializers/active_record.rb:743:in block in find_in_batches' /var/canvas/vendor/bundle/ruby/2.6.0/gems/switchman-1.15.2/lib/switchman/active_record/relation.rb:102:in activate'
/var/canvas/config/initializers/active_record.rb:743:in find_in_batches' /var/canvas/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/relation/batches.rb:69:in find_each'
/var/canvas/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/querying.rb:11:in find_each' /var/canvas/lib/tasks/brand_configs.rake:9:in block (2 levels) in <top (required)>'
/var/canvas/vendor/bundle/ruby/2.6.0/gems/switchman-1.15.2/lib/tasks/switchman.rake:87:in block (6 levels) in shardify_task' /var/canvas/vendor/bundle/ruby/2.6.0/gems/switchman-1.15.2/lib/tasks/switchman.rake:87:in each'
/var/canvas/vendor/bundle/ruby/2.6.0/gems/switchman-1.15.2/lib/tasks/switchman.rake:87:in block (5 levels) in shardify_task' /var/canvas/vendor/bundle/ruby/2.6.0/gems/switchman-1.15.2/lib/switchman/database_server.rb:107:in unshackle'
/var/canvas/vendor/bundle/ruby/2.6.0/gems/switchman-1.15.2/lib/tasks/switchman.rake:86:in block (4 levels) in shardify_task' /var/canvas/vendor/bundle/ruby/2.6.0/gems/switchman-1.15.2/app/models/switchman/shard.rb:373:in block (2 levels) in with_each_shard'
/var/canvas/vendor/bundle/ruby/2.6.0/gems/switchman-1.15.2/app/models/switchman/shard.rb:625:in block in activate' /var/canvas/vendor/bundle/ruby/2.6.0/gems/switchman-1.15.2/app/models/switchman/shard.rb:93:in activate'
/var/canvas/vendor/bundle/ruby/2.6.0/gems/switchman-1.15.2/app/models/switchman/shard.rb:624:in activate' /var/canvas/vendor/bundle/ruby/2.6.0/gems/switchman-1.15.2/app/models/switchman/shard.rb:371:in block in with_each_shard'
/var/canvas/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/relation/delegation.rb:71:in each' /var/canvas/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.4/lib/active_record/relation/delegation.rb:71:in each'
/var/canvas/vendor/bundle/ruby/2.6.0/gems/switchman-1.15.2/app/models/switchman/shard.rb:367:in with_each_shard' /var/canvas/vendor/bundle/ruby/2.6.0/gems/switchman-1.15.2/lib/tasks/switchman.rake:71:in block (3 levels) in shardify_task'
/var/canvas/vendor/bundle/ruby/2.6.0/gems/switchman-1.15.2/lib/switchman/database_server.rb:107:in unshackle' /var/canvas/vendor/bundle/ruby/2.6.0/gems/switchman-1.15.2/lib/tasks/switchman.rake:68:in block (2 levels) in shardify_task'
/var/canvas/vendor/bundle/ruby/2.6.0/gems/switchman-1.15.2/lib/switchman/shackles.rb:22:in activate' /var/canvas/vendor/bundle/ruby/2.6.0/gems/switchman-inst-jobs-1.5.2/lib/switchman_inst_jobs/shackles.rb:8:in activate'
/var/canvas/vendor/bundle/ruby/2.6.0/gems/switchman-1.15.2/lib/tasks/switchman.rake:67:in block in shardify_task' /var/canvas/lib/tasks/css.rake:18:in block (3 levels) in <top (required)>'
/var/canvas/lib/tasks/css.rake:16:in block (2 levels) in <top (required)>' /var/canvas/lib/tasks/canvas.rake:40:in block (2 levels) in <top (required)>'
/var/canvas/vendor/bundle/ruby/2.6.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
Tasks: TOP => brand_configs:write
(See full trace by running task with --trace)

So I tried to fix it by executing the followings:


mv db/migrate/_regenerate_brand_files_based_on_new_defaults_predeploy.rb
db/migrate/29801541086306_regenerate_brand_files_based_on_new_defaults_predeploy.rb
&&
mv db/migrate/
_regenerate_brand_files_based_on_new_defaults_postdeploy.rb
db/migrate/29801541086307_regenerate_brand_files_based_on_new_defaults_postdeploy.rb

And retried to execute the command again.
But in that case, errors are changed:

rake aborted!
please don't create migrations with a version number in the future: RegenerateBrandFilesBasedOnNewDefaultsPostdeploy 29801541086307

So totally I got stupid.
How can I solve this issue?
Thanks for everybody's regards.

0 Likes