I’m trying to deploy a sample rails project and have encountered the following error:
ERROR [build 6/6] RUN SECRET_KEY_BASE=DUMMY ./bin/rails assets:precom
These are the logs i get after run fly deploy
=> ERROR [build 6/6] RUN SECRET_KEY_BASE=DUMMY ./bin/rails assets:precom 1.2s
------
> [build 6/6] RUN SECRET_KEY_BASE=DUMMY ./bin/rails assets:precompile:
#16 1.150 rails aborted!
#16 1.150 NameError: uninitialized constant LetterOpenerWeb
#16 1.150 /rails/config/routes.rb:5:in `block in <main>'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.4.3/lib/action_dispatch/routing/route_set.rb:428:in `instance_exec'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.4.3/lib/action_dispatch/routing/route_set.rb:428:in `eval_block'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.4.3/lib/action_dispatch/routing/route_set.rb:410:in `draw'
#16 1.150 /rails/config/routes.rb:1:in `<main>'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.4.3/lib/rails/application/routes_reloader.rb:50:in `load'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.4.3/lib/rails/application/routes_reloader.rb:50:in `block in load_paths'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.4.3/lib/rails/application/routes_reloader.rb:50:in `each'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.4.3/lib/rails/application/routes_reloader.rb:50:in `load_paths'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.4.3/lib/rails/application/routes_reloader.rb:24:in `reload!'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.4.3/lib/rails/application/routes_reloader.rb:38:in `block in updater'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/file_update_checker.rb:83:in `execute'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.4.3/lib/rails/application/routes_reloader.rb:13:in `execute'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.4.3/lib/rails/application/finisher.rb:158:in `block in <module:Finisher>'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.4.3/lib/rails/initializable.rb:32:in `instance_exec'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.4.3/lib/rails/initializable.rb:32:in `run'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.4.3/lib/rails/initializable.rb:61:in `block in run_initializers'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.4.3/lib/rails/initializable.rb:60:in `run_initializers'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.4.3/lib/rails/application.rb:372:in `initialize!'
#16 1.150 /rails/config/environment.rb:5:in `<main>'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/zeitwerk-2.6.7/lib/zeitwerk/kernel.rb:38:in `require'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.4.3/lib/rails/application.rb:348:in `require_environment!'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.4.3/lib/rails/application.rb:511:in `block in run_tasks_blocks'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/task.rb:61:in `block (2 levels) in define'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:243:in `block in invoke_prerequisites'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:241:in `each'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:241:in `invoke_prerequisites'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:218:in `block in invoke_with_call_chain'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.4.3/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.4.3/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/rake_module.rb:59:in `with_application'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.4.3/lib/rails/commands/rake/rake_command.rb:18:in `perform'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.4.3/lib/rails/command.rb:51:in `invoke'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/railties-7.0.4.3/lib/rails/commands.rb:18:in `<main>'
#16 1.150 /rails/vendor/bundle/ruby/3.2.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
#16 1.150 Tasks: TOP => environment
#16 1.150 (See full trace by running task with --trace)
------
Error failed to fetch an image or build from source: error building: executor failed running [/bin/sh -c SECRET_KEY_BASE=DUMMY ./bin/rails assets:precompile]: exit code: 1
I know it similar to this issue, However, the solution is not resolving my issues.
Need a solution for someone who is just getting started with rails.