assaf / vanity

Experiment Driven Development for Ruby
http://vanity.labnotes.org
MIT License
1.55k stars 269 forks source link

failing to deploy to heroku #351

Closed tansaku closed 5 years ago

tansaku commented 5 years ago
remote:        NoMethodError: undefined method `username' for #<URI::Generic:0x00005600aaac1d08>
remote:        (erb):19:in `<main>'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/vanity-2.2.10/lib/vanity/configuration.rb:212:in `connection_params'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/vanity-2.2.10/lib/vanity/vanity.rb:95:in `connect!'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/vanity-2.2.10/lib/vanity/vanity.rb:84:in `connection'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/vanity-2.2.10/lib/vanity/frameworks/rails.rb:12:in `block in load!'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/vanity-2.2.10/lib/vanity/frameworks/rails.rb:12:in `block in load!'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:67:in `block in execute_hook'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:49:in `each'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application/finisher.rb:73:in `block in <module:Finisher>'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/initializable.rb:30:in `instance_exec'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/initializable.rb:30:in `run'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/initializable.rb:59:in `block in run_initializers'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/initializable.rb:58:in `run_initializers'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application.rb:353:in `initialize!'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/railtie.rb:185:in `public_send'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/railtie.rb:185:in `method_missing'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/config/environment.rb:6:in `<top (required)>'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application.rb:329:in `require_environment!'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application.rb:445:in `block in run_tasks_blocks'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/airbrake-7.3.5/lib/airbrake/rake.rb:17:in `execute'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/airbrake-7.3.5/lib/airbrake/rake.rb:17:in `execute'
remote:        /tmp/build_5898513b30223c77a915865c78808e7e/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
tansaku commented 5 years ago

our vanity.yml is as mentioned in https://github.com/assaf/vanity/issues/349

tansaku commented 5 years ago

it's probably related to our production config:

production:
  active_record_adapter: postgresql
  <% uri = URI.parse(ENV['DATABASE_URL']) rescue uri = nil %>
  <% if uri %>
  host:     <%= uri.host %>
  username: <%= uri.username %>
  password: <%= uri.password %>
  port:     <%= uri.port %>
  database: <%= uri.path.sub('/', '') %>
  <% end %>

and the way the heroku DATABASE_URL is structured ...

tansaku commented 5 years ago

ah, okay, so the problem was that it should be uri.user not uri.username