User index page empty on Railway, works locally and on Heroku

Bbeccamay11/8/2022
I have no idea why this might be happening, but I'm trying to migrate my Rails 7 app from Heroku to Railway and for some reason the user index page, viewable only by admins, is showing up empty (page loads but no users shown).

There are users in the DB, I can log in and see their show pages, as well as see them in the console.

The code works fine locally, as well as when deployed on Heroku. You can compare local server logs with Railway logs and see that for some reason on Railway it's not getting users.
Bbeccamay11/8/2022
Local logs:

Started GET "/en/users" for ::1 at 2022-11-08 13:38:38 +0200
Processing by UsersController#index as HTML
Parameters: {"locale"=>"en"}
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 1], ["LIMIT", 1]]
↳ app/controllers/users_controller.rb:18:in `admin_user'
Rendering layout layouts/application.html.erb
Rendering users/index.html.erb within layouts/application
User Count (0.4ms) SELECT COUNT() FROM "users" WHERE "users"."confirmed" = $1 [["confirmed", true]]
↳ app/views/users/index.html.erb:4
User Load (0.3ms) SELECT "users".
FROM "users" WHERE "users"."confirmed" = $1 LIMIT $2 OFFSET $3 [["confirmed", true], ["LIMIT", 30], ["OFFSET", 0]]
↳ app/views/users/index.html.erb:7
Rendered collection of users/_user.html.erb [30 times] (Duration: 4.6ms | Allocations: 3858)
Rendered users/index.html.erb within layouts/application (Duration: 11.0ms | Allocations: 6653)
Rendered layouts/_bootstrap_cdn.html.erb (Duration: 0.0ms | Allocations: 16)
Rendered layouts/_rails_default.html.erb (Duration: 7.3ms | Allocations: 5483)
Rendered layouts/_shim.html.erb (Duration: 0.0ms | Allocations: 15)
Rendered shared/_search_bar.erb (Duration: 0.0ms | Allocations: 24)
Rendered user/_session_manager.html.erb (Duration: 0.5ms | Allocations: 366)
Rendered shared/_search_modal.erb (Duration: 0.6ms | Allocations: 592)
Rendered layouts/_header.html.erb (Duration: 1.8ms | Allocations: 1355)
Rendered layouts/_messages.html.erb (Duration: 0.0ms | Allocations: 27)
Rendered layouts/_footer.html.erb (Duration: 0.5ms | Allocations: 158)
Rendered layout layouts/application.html.erb (Duration: 23.8ms | Allocations: 15919)
Completed 200 OK in 31ms (Views: 23.6ms | ActiveRecord: 1.2ms | Allocations: 17431)
Bbeccamay11/8/2022
Production server logs:

I, [2022-11-08T11:39:47.740716 #19] INFO -- : [8cc8cc81-a68c-4ae6-80a8-a68b31ae0a34] Started GET "/en/users" for 79.183.112.167 at 2022-11-08 11:39:47 +0000
I, [2022-11-08T11:39:47.741782 #19] INFO -- : [8cc8cc81-a68c-4ae6-80a8-a68b31ae0a34] Processing by UsersController#index as HTML
I, [2022-11-08T11:39:47.741846 #19] INFO -- : [8cc8cc81-a68c-4ae6-80a8-a68b31ae0a34] Parameters: {"locale"=>"en"}
I, [2022-11-08T11:39:47.753841 #19] INFO -- : [8cc8cc81-a68c-4ae6-80a8-a68b31ae0a34] Rendered users/index.html.erb within layouts/application (Duration: 3.9ms | Allocations: 414)
I, [2022-11-08T11:39:47.758103 #19] INFO -- : [8cc8cc81-a68c-4ae6-80a8-a68b31ae0a34] Rendered layout layouts/application.html.erb (Duration: 8.2ms | Allocations: 2537)
I, [2022-11-08T11:39:47.758466 #19] INFO -- : [8cc8cc81-a68c-4ae6-80a8-a68b31ae0a34] Completed 200 OK in 17ms (Views: 6.5ms | ActiveRecord: 4.2ms | Allocations: 3549)
Aangelo11/8/2022
Hey there!

Can you enable - RAILS_SERVE_STATIC_FILES to true in the service variables pane?
Aangelo11/8/2022
also tagging in @Cereal who is more familiar with Rails on Railway than I
UUUnknown User11/8/2022
3 Messages Not Public
Sign In & Join Server To View
Aangelo11/8/2022
Pinging @beccamay
Bbeccamay11/8/2022
contollers/users_controller.rb
class UsersController < ApplicationController
  before_action :authenticate_user!, only: :show
  before_action :admin_user, :only => [:index, :edit, :update, :destroy]


  def show
    @user = User.find(params[:id])
  end

  def index
    @users = User.where(confirmed: true).paginate(page:params[:page])
  end

  private

    def admin_user
      redirect_to(root_url, status: :see_other) unless
      current_user && current_user.admin?
    end
end
Aangelo11/8/2022
tip, you can make it syntax highlighted by using `
Aangelo11/8/2022
I will show ya
Bbeccamay11/8/2022
And here's the view, as you can see nothing crazy...

views/users/index.html.erb
<% provide(:title, 'All users') %>
<h2>All users</h2>

<%= will_paginate(@users) %>

  <ul class="users">
    <%= render @users %>
  </ul>

<%= will_paginate(@users) %>

views/users/_user.html.erb
<li>
  <%= gravatar_for user, size: 50 %>
  <%= link_to user.name, user %>
</li>
Aangelo11/8/2022
class UsersController < ApplicationController
  before_action :authenticate_user!, only: :show
  before_action :admin_user, :only => [:index, :edit, :update, :destroy]


  def show
    @user = User.find(params[:id])
  end

  def index
    @users = User.where(confirmed: true).paginate(page:params[:page])
  end

  private

    def admin_user
      redirect_to(root_url, status: :see_other) unless
      current_user && current_user.admin?
    end
end
Aangelo11/8/2022
three backticks, and then language
Bbeccamay11/8/2022
thanks i'm not sure how to make it colored though? i used three backticks
Aangelo11/8/2022
you have to add the language after the three backticks
Aangelo11/8/2022
so ruby in this case
Bbeccamay11/8/2022
RAILS_SERVE_STATIC_FILES is enabled
Aangelo11/8/2022
I am unsure that erb works.
Bbeccamay11/8/2022
awesome thanks for the tip! syntax highlighting added. now let's see if you can help me with the user index, really can't understand what's going on 😦
Aangelo11/8/2022
One last thing, Project ID?
Aangelo11/8/2022
(cmd + k/ctrl + k) -> project id'
Aangelo11/8/2022
that way I can look into your logs
Bbeccamay11/8/2022
Is project ID sensitive?
Aangelo11/8/2022
wdym
Aangelo11/8/2022
its a UUID
Aangelo11/8/2022
not like a password or anything, no other user can do anything with that information
Bbeccamay11/8/2022
ok thanks - 83791c3c-35a4-439c-96ea-34c41b9aed33
Aangelo11/8/2022
looking
Aangelo11/8/2022
Unrelated: You really shouldn't be using the Heroku buildpacks, those are going away in a week
Aangelo11/8/2022
I am looking into why that build is failing in the first place
Bbeccamay11/8/2022
Uh oh, thanks for the heads up. Can you point me to resources what to use instead of Heroku buildpacks? I am new at this so if there's a walkthrough doc somewhere that would be great
Aangelo11/8/2022
Gotcha- we actually have a community member working on a Rails walkthrough doc haha
Aangelo11/8/2022
I am not a Rails dev but used to be one, so I can work my way through Ruby
Aangelo11/8/2022
also, I notice that a lot of Rails dev are having issues on here, so REALLY committed to fixing that experience
Aangelo11/8/2022
Can you do me a favor, slam through another railway up in your terminal?
Bbeccamay11/8/2022
Good to hear. It's been rough trying to migrate from Heroku last couple weeks, I'm trying to make it work but so many issues
Aangelo11/8/2022
I can understand that frustration, very sorry.
Aangelo11/8/2022
Lets get you on some good footing.
Bbeccamay11/8/2022
did it
Aangelo11/8/2022
lmk when you have kicked this off.
Aangelo11/8/2022
cool, looking
Bbeccamay11/8/2022
build failed
Aangelo11/8/2022
expected, debugging
Aangelo11/8/2022
strange its complaining about: #9 4.067 E: Unable to locate package libimagemagick-dev
Aangelo11/8/2022
but you have the right vars
Aangelo11/8/2022
Roping in another eng
Bbeccamay11/8/2022
appreciate it
Aangelo11/8/2022
can you add a file called nixpacks.toml with the contents:
[phases.install]
  cmds = ['apt install -y libmagickwand-dev'] 
Aangelo11/8/2022
then slam a up after
Bbeccamay11/8/2022
to the top level of the project?
Aangelo11/8/2022
yes
Aangelo11/8/2022
It seems to be an issue with Imagemagick and the package deps it needs
Aangelo11/8/2022
(for builds)
Aangelo11/8/2022
then I think this would solve the other issue too
Aangelo11/8/2022
Because another usr reported an issue with the other buildpack messing with the templates, but this is a guess
Bbeccamay11/8/2022
added
Aangelo11/8/2022
cool watching
Aangelo11/8/2022
var conflict, fixing
Aangelo11/8/2022
Okay, taking longer, this is good
Aangelo11/8/2022
hehe
Bbeccamay11/8/2022
anything different is good...
Aangelo11/8/2022
yep, totally fresh install
Bbeccamay11/8/2022
even if this makes the build succeed, I don't see how this would relate to the users index. I'm not doing any image processing there
Bbeccamay11/8/2022
ok let's see
Bbeccamay11/8/2022
still empty
Aangelo11/8/2022
ok
Aangelo11/8/2022
lets see
Aangelo11/8/2022
still looking
Aangelo11/8/2022
so for some reason, it can't find these Gems, thats why its triggering the error

#18 0.834 /usr/local/rvm/gems/ruby-3.1.2/gems/bundler-2.3.14/lib/bundler/definition.rb:486:in `materialize': Could not find active_storage_validations-1.0.3, aws-sdk-s3-1.116.0, bootsnap-1.12.0, bootstrap-sass-3.4.1, bootstrap-will_paginate-1.0.0, devise-4.8.1, geocoder-1.8.0, image_processing-1.12.2, importmap-rails-1.1.0, jbuilder-2.11.5, jsonapi-serializer-2.2.0, pg-1.4.4, puma-5.6.4, rails-7.0.3, rails-i18n-7.0.5, ransack-3.2.1, sprockets-rails-3.4.2, stimulus-rails-1.0.4, turbo-rails-1.1.1, will_paginate-3.3.1, debug-1.5.0, faker-2.20.0, web-console-4.2.0, capybara-3.37.1, selenium-webdriver-4.2.0, webdrivers-5.0.0, rails-controller-testing-1.0.5, minitest-reporters-1.5.0, guard-2.18.0, guard-minitest-2.4.6, activejob-7.0.3, activemodel-7.0.3, activestorage-7.0.3, activesupport-7.0.3, aws-sdk-core-3.164.0, aws-sdk-kms-1.58.0, aws-sigv4-1.5.2, msgpack-1.5.2, autoprefixer-rails-10.4.7.0, sassc-2.4.0, bcrypt-3.1.18, orm_adapter-0.5.0, railties-7.0.3, responders-3.0.1, warden-1.2.9, mini_magick-4.11.0, ruby-vips-2.1.4, actionpack-7.0.3, actionview-7.0.3, nio4r-2.5.8, actioncable-7.0.3, actionmailbox-7.0.3, actionmailer-7.0.3, actiontext-7.0.3, activerecord-7.0.3, i18n-1.10.0, sprockets-4.0.3, reline-0.3.1, bindex-0.8.1, addressable-2.8.0, mini_mime-1.1.2, nokogiri-1.13.6-x86_64-linux, rack-2.2.3.1, rack-test-1.1.0, regexp_parser-2.5.0, xpath-3.2.0, childprocess-4.1.0, rubyzip-2.3.2, websocket-1.2.9, ansi-1.5.0, builder-3.2.4, ruby-progressbar-1.11.0, formatador-1.1.0, listen-3.7.1, lumberjack-1.2.8, nenv-0.3.0, notiffany-0.1.3, pry-0.14.1, shellany-0.0.1, thor-1.2.1, guard-compat-1.2.1, globalid-1.0.0, marcel-1.0.2, concurrent-ruby-1.1.10, tzinfo-2.0.4, aws-eventstream-1.2.0, aws-partitions-1.649.0, jmespath-1.6.1, execjs-2.8.1, ffi-1.15.5, method_source-1.0.0, zeitwerk-2.6.0, rails-dom-testing-2.0.3, rails-html-sanitizer-1.4.3, erubi-1.10.0, websocket-driver-0.7.5, mail-2.7.1, public_suffix-4.0.7, rb-fsevent-0.11.1, rb-inotify-0.10.1, coderay-1.1.3, loofah-2.18.0, websocket-extensions-0.1.5, net-protocol-0.1.3, strscan-3.0.3, timeout-0.3.0, crass-1.0.6 in any of the sources (Bundler::GemNotFound)
Aangelo11/8/2022
Working with our Nixpacks eng, one sec
Aangelo11/8/2022
also tagging someone who might know
Aangelo11/8/2022
cc @wyzlle
Bbeccamay11/8/2022
Found a typo in the gemfile, updating and deploying again
UUUnknown User11/8/2022
Message Not Public
Sign In & Join Server To View
Bbeccamay11/8/2022
Hi
Bbeccamay11/8/2022
Now for some reason it's installing ruby and doing a whole lot of stuff it didn't in previous deploys.
UUUnknown User11/8/2022
Message Not Public
Sign In & Join Server To View
Aangelo11/8/2022
same issue

#18 ERROR: executor failed running [/bin/bash -ol pipefail -c bundle exec rake assets:precompile]: exit code: 1
-----
> [stage-0 14/15] RUN  bundle exec rake assets:precompile:
-----
executor failed running [/bin/bash -ol pipefail -c bundle exec rake assets:precompile]: exit code: 1
 
Error: Docker build failed
Aangelo11/8/2022
We have a hunch on what it might be.
Aangelo11/8/2022
going to switch ya back to Heroku stuff just so we can fix issue #1 :'P
Aangelo11/8/2022
At least we caught this.
Aangelo11/8/2022
Re-building
Aangelo11/8/2022
!
!     There was an error parsing your Gemfile, we cannot continue
!
!     [!] There was an error parsing `Gemfile`: syntax error, unexpected string literal, expecting `do' or '{' or '(' - gem "aws-sdk-s3",                r...
!     ^
!     /workspace/Gemfile:7: syntax error, unexpected ',', expecting end-of-input
!     gem "aws-sdk-s3",                require: false
!     ^
!     . Bundler cannot continue.
!
!     #  from /workspace/Gemfile:7
!     #  -------------------------------------------
!     #  gem "active_storage_validations",
!     >  gem "aws-sdk-s3",                require: false
!     #  gem "bootsnap",                   "1.12.0", require: false
!     #  -------------------------------------------
Bbeccamay11/8/2022
One second reverting that change
Bbeccamay11/8/2022
deployed again with gemfile fixed
UUUnknown User11/8/2022
Message Not Public
Sign In & Join Server To View
Bbeccamay11/8/2022
gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 3.3.7
  - RUBY VERSION: 3.1.2 (2022-04-12 patchlevel 20) [arm64-darwin21]
  - INSTALLATION DIRECTORY: /Users/rebeccamaybaum/.rvm/gems/ruby-3.1.2
  - USER INSTALLATION DIRECTORY: /Users/rebeccamaybaum/.gem/ruby/3.1.0
  - RUBY EXECUTABLE: /Users/rebeccamaybaum/.rvm/rubies/ruby-3.1.2/bin/ruby
  - GIT EXECUTABLE: /opt/homebrew/bin/git
  - EXECUTABLE DIRECTORY: /Users/rebeccamaybaum/.rvm/gems/ruby-3.1.2/bin
  - SPEC CACHE DIRECTORY: /Users/rebeccamaybaum/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/rebeccamaybaum/.rvm/rubies/ruby-3.1.2/etc
  - RUBYGEMS PLATFORMS:
     - ruby
     - arm64-darwin-21
  - GEM PATHS:
     - /Users/rebeccamaybaum/.rvm/gems/ruby-3.1.2
     - /Users/rebeccamaybaum/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-document"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/rebeccamaybaum/.rvm/gems/ruby-3.1.2/bin
     - /Users/rebeccamaybaum/.rvm/gems/ruby-3.1.2@global/bin
     - /Users/rebeccamaybaum/.rvm/rubies/ruby-3.1.2/bin
     - /Users/rebeccamaybaum/.rvm/bin
     - /usr/local/bin
     - /opt/homebrew/bin
     - /opt/homebrew/sbin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
Bbeccamay11/8/2022
Good news that the latest build succeeded. Bad news that the original issue is still happening :/
Aangelo11/8/2022
Lets fix that now
Bbeccamay11/8/2022
Honestly I actually think now the more urgent issue is moving from Heroku buildpacks... I will keep working on the user index issue but if buildpacks are gone next week that's bigger
Bbeccamay11/8/2022
I don't know how to convert to nixpacks
Bbeccamay11/8/2022
When do you think the documentation will be ready for that?
Aangelo11/8/2022
Well, it should just be slot in
Aangelo11/8/2022
so the issue is on our end
Aangelo11/8/2022
luckily we have Jr working on that now
Bbeccamay11/8/2022
Meaning Nixpacks should be slot in?
Aangelo11/8/2022
Yes