Estoy intentando actualizar a la última versión estable (de 2.8.10 a 2.8.11) y se está abortando al llamar a themes:update. Intenté ejecutar la tarea themes:update manualmente y el error es el mismo:
# rake themes:update
Checking 'xyz (darker)' for 'default'... Failed to update 'xyz (darker)': undefined method `scheme' for nil:NilClass
rake aborted!
NoMethodError: undefined method `scheme' for nil:NilClass
/var/www/discourse/lib/theme_store/git_importer.rb:129:in `clone_http!'
/var/www/discourse/lib/theme_store/git_importer.rb:94:in `clone!'
/var/www/discourse/lib/theme_store/git_importer.rb:19:in `import!'
/var/www/discourse/app/models/remote_theme.rb:126:in `update_remote_version'
/var/www/discourse/lib/tasks/themes.rake:62:in `block in update_themes'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation/batches.rb:71:in `block (2 levels) in find_each'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation/batches.rb:71:in `each'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation/batches.rb:71:in `block in find_each'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation/batches.rb:138:in `block in find_in_batches'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation/batches.rb:245:in `block in in_batches'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation/batches.rb:229:in `loop'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation/batches.rb:229:in `in_batches'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation/batches.rb:137:in `find_in_batches'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation/batches.rb:70:in `find_each'
/var/www/discourse/lib/tasks/themes.rake:56:in `update_themes'
/var/www/discourse/lib/tasks/themes.rake:87:in `block (2 levels) in <main>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rails_multisite-4.0.0/lib/rails_multisite/connection_management.rb:80:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rails_multisite-4.0.0/lib/rails_multisite/connection_management.rb:90:in `each_connection'
/var/www/discourse/lib/tasks/themes.rake:86:in `block in <main>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:58:in `load'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:58:in `kernel_load'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:23:in `run'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.22/lib/bundler/cli.rb:486:in `exec'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.22/lib/bundler/cli.rb:31:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.22/lib/bundler/cli.rb:25:in `start'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.22/exe/bundle:48:in `block in <top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.22/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.22/exe/bundle:36:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Tasks: TOP => themes:update
(See full trace by running task with --trace)
El tema en cuestión no ha sido modificado (en más de un año) y es bastante básico; solo cambia algunos colores y añade una única regla CSS, por lo que parece que algo ha cambiado en Discourse. No estoy seguro si es relevante, pero el tema es remoto (repositorios privados de GitHub).
Después de esto, noté que si intento actualizar el tema desde la interfaz web, obtengo un error 500 con un error similar:
Started PUT "/admin/themes/48" for x.x.x.x at 2022-11-14 17:44:14 +0000
Processing by Admin::ThemesController#update as */*
Parameters: {"theme"=>{"remote_check"=>true}, "id"=>"48"}
Completed 500 Internal Server Error in 1904ms (ActiveRecord: 0.0ms | Allocations: 24475)
NoMethodError (undefined method `scheme' for nil:NilClass)
lib/theme_store/git_importer.rb:129:in `clone_http!'
lib/theme_store/git_importer.rb:94:in `clone!'
lib/theme_store/git_importer.rb:19:in `import!'
app/models/remote_theme.rb:126:in `update_remote_version'
app/controllers/admin/themes_controller.rb:207:in `update'
app/controllers/application_controller.rb:387:in `block in with_resolved_locale'
app/controllers/application_controller.rb:387:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:361:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/request_tracker.rb:198:in `call'
¿Alguna idea de qué debería investigar? Puedo compartir los archivos del tema si ayuda.
EDITAR PARA AÑADIR: Cambiar el repositorio a público detuvo el error, por lo que parece que algo ha cambiado en el manejo de repositorios privados que usan tokens de autenticación. Sin embargo, extrañamente, volver a poner el repositorio en privado no devolvió el error al reconstruir… Además, hay dos temas remotos con la misma configuración (en un repositorio privado) y solo uno de ellos falló.