fractaledmind / enlitenment

A Rails application template script to lead your app to SQLite enlightenment.
45 stars 4 forks source link

Template fails without mission control ENV vars #6

Closed rossta closed 3 months ago

rossta commented 3 months ago

I ran the template script against https://github.com/joyofrails/joyofrails.com

During the first run, I got the following error (excerpt):

      def_db    cache (database.yml)
      add_db    cache -> development (database.yml)
      add_db    cache -> test (database.yml)
      add_db    cache -> production (database.yml)
      add_db    cache -> wasm (database.yml)
         run    bin/rails generate solid_cache:install from "."
** [Honeybadger] Development mode is enabled. Data will not be reported until you deploy your app. level=2 pid=89386
[dotenv] Loaded .env.development
[dotenv] Loaded .env
[dotenv] Loaded .env.development
[dotenv] Loaded .env
** [Honeybadger] Reporting error id=cd610c2d-55c6-414f-a6a8-fcf23227cf66 level=1 pid=89386
** [Honeybadger] Success ⚡ Development mode is enabled; this error will be reported if it occurs after you deploy your app. id=cd610c2d-55c6-414f-a6a8-fcf23227cf66 level=1 pid=89386
~/.gem/ruby/3.3.4/gems/actionpack-7.1.3.4/lib/action_controller/metal/http_authentication.rb:77:in `http_basic_authenticate_with': Expected name: to be a String, got NilClass (ArgumentError)

            raise ArgumentError, "Expected name: to be a String, got #{name.class}" unless name.is_a?(String)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        from ~/dev/joyofrails/joyofrails.com/app/controllers/mission_control/base_controller.rb:20:in `<class:BaseController>'
        from ~/dev/joyofrails/joyofrails.com/app/controllers/mission_control/base_controller.rb:17:in `<module:MissionControl>'
        from ~/dev/joyofrails/joyofrails.com/app/controllers/mission_control/base_controller.rb:1:in `<main>'
        from ~/.rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
        from ~/.rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
        from ~/.gem/ruby/3.3.4/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        from ~/.gem/ruby/3.3.4/gems/zeitwerk-2.6.16/lib/zeitwerk/kernel.rb:26:in `require'
        from ~/.gem/ruby/3.3.4/gems/activesupport-7.1.3.4/lib/active_support/inflector/methods.rb:290:in `const_get'
        from ~/.gem/ruby/3.3.4/gems/activesupport-7.1.3.4/lib/active_support/inflector/methods.rb:290:in `constantize'
        from ~/.gem/ruby/3.3.4/gems/activesupport-7.1.3.4/lib/active_support/core_ext/string/inflections.rb:74:in `constantize'
        from ~/.gem/ruby/3.3.4/gems/mission_control-jobs-0.2.1/lib/mission_control/jobs/engine.rb:56:in `block in <class:Engine>'
        from ~/.gem/ruby/3.3.4/gems/activesupport-7.1.3.4/lib/active_support/lazy_load_hooks.rb:94:in `block in execute_hook'
        from ~/.gem/ruby/3.3.4/gems/activesupport-7.1.3.4/lib/active_support/lazy_load_hooks.rb:87:in `with_execution_control'
        from ~/.gem/ruby/3.3.4/gems/activesupport-7.1.3.4/lib/active_support/lazy_load_hooks.rb:92:in `execute_hook'
        from ~/.gem/ruby/3.3.4/gems/activesupport-7.1.3.4/lib/active_support/lazy_load_hooks.rb:78:in `block in run_load_hooks'
        from ~/.gem/ruby/3.3.4/gems/activesupport-7.1.3.4/lib/active_support/lazy_load_hooks.rb:77:in `each'
        from ~/.gem/ruby/3.3.4/gems/activesupport-7.1.3.4/lib/active_support/lazy_load_hooks.rb:77:in `run_load_hooks'
        from ~/.gem/ruby/3.3.4/gems/railties-7.1.3.4/lib/rails/application/finisher.rb:93:in `block in <module:Finisher>'
        from ~/.gem/ruby/3.3.4/gems/railties-7.1.3.4/lib/rails/initializable.rb:32:in `instance_exec'
        from ~/.gem/ruby/3.3.4/gems/railties-7.1.3.4/lib/rails/initializable.rb:32:in `run'
        from ~/.gem/ruby/3.3.4/gems/railties-7.1.3.4/lib/rails/initializable.rb:61:in `block in run_initializers'
        from ~/.rubies/ruby-3.3.4/lib/ruby/3.3.0/tsort.rb:231:in `block in tsort_each'
        from ~/.rubies/ruby-3.3.4/lib/ruby/3.3.0/tsort.rb:353:in `block (2 levels) in each_strongly_connected_component'
        from ~/.rubies/ruby-3.3.4/lib/ruby/3.3.0/tsort.rb:434:in `each_strongly_connected_component_from'
        from ~/.rubies/ruby-3.3.4/lib/ruby/3.3.0/tsort.rb:352:in `block in each_strongly_connected_component'
        from ~/.rubies/ruby-3.3.4/lib/ruby/3.3.0/tsort.rb:350:in `each'
        from ~/.rubies/ruby-3.3.4/lib/ruby/3.3.0/tsort.rb:350:in `call'
        from ~/.rubies/ruby-3.3.4/lib/ruby/3.3.0/tsort.rb:350:in `each_strongly_connected_component'
        from ~/.rubies/ruby-3.3.4/lib/ruby/3.3.0/tsort.rb:229:in `tsort_each'
        from ~/.rubies/ruby-3.3.4/lib/ruby/3.3.0/tsort.rb:208:in `tsort_each'
        from ~/.gem/ruby/3.3.4/gems/railties-7.1.3.4/lib/rails/initializable.rb:60:in `run_initializers'
        from ~/.gem/ruby/3.3.4/gems/railties-7.1.3.4/lib/rails/application.rb:426:in `initialize!'
        from ~/dev/joyofrails/joyofrails.com/config/environment.rb:5:in `<main>'
        from ~/.rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
        from ~/.rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
        from ~/.gem/ruby/3.3.4/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        from ~/.gem/ruby/3.3.4/gems/zeitwerk-2.6.16/lib/zeitwerk/kernel.rb:34:in `require'
        from ~/.gem/ruby/3.3.4/gems/railties-7.1.3.4/lib/rails/application.rb:402:in `require_environment!'
        from ~/.gem/ruby/3.3.4/gems/railties-7.1.3.4/lib/rails/command/actions.rb:20:in `boot_application!'
        from ~/.gem/ruby/3.3.4/gems/railties-7.1.3.4/lib/rails/commands/generate/generate_command.rb:21:in `perform'
        from ~/.gem/ruby/3.3.4/gems/thor-1.3.1/lib/thor/command.rb:28:in `run'
        from ~/.gem/ruby/3.3.4/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command'
        from ~/.gem/ruby/3.3.4/gems/railties-7.1.3.4/lib/rails/command/base.rb:178:in `invoke_command'
        from ~/.gem/ruby/3.3.4/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch'
        from ~/.gem/ruby/3.3.4/gems/railties-7.1.3.4/lib/rails/command/base.rb:73:in `perform'
        from ~/.gem/ruby/3.3.4/gems/railties-7.1.3.4/lib/rails/command.rb:71:in `block in invoke'
        from ~/.gem/ruby/3.3.4/gems/railties-7.1.3.4/lib/rails/command.rb:149:in `with_argv'
        from ~/.gem/ruby/3.3.4/gems/railties-7.1.3.4/lib/rails/command.rb:69:in `invoke'
        from ~/.gem/ruby/3.3.4/gems/railties-7.1.3.4/lib/rails/commands.rb:18:in `<main>'
        from ~/.rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
        from ~/.rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
        from ~/.gem/ruby/3.3.4/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        from bin/rails:4:in `<main>'

The failing line is located in the generated app/controllers/mission_control/base_controller.rb at:

    http_basic_authenticate_with name: MissionControl.username, password: MissionControl.password

In my case, the workaround was to define ENV vars for MISSION_CONTROL_USERNAME and MISSION_CONTROL_PASSWORD after which I was able to successfully run the script.

fractaledmind commented 3 months ago

I see. I just pushed a new commit that I believe would address this. What do you think? https://github.com/fractaledmind/enlitenment/commit/de09e71fd70e4617f2aa46be464110feffeef832

fractaledmind commented 3 months ago

@rossta: Can you confirm that this issue is fixed?

rossta commented 3 months ago

@fractaledmind Yes, fixed! I reran the template from a clean slate and did not see the error. (I did run into a new one I can report separately).