User index page empty on Railway, works locally and on Heroku
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.
64 Replies
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)
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)
Hey there!
Can you enable - RAILS_SERVE_STATIC_FILES to true in the service variables pane?
also tagging in @Cereal who is more familiar with Rails on Railway than I
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Pinging @beccamay
contollers/users_controller.rb
tip, you can make it syntax highlighted by using `
I will show ya
And here's the view, as you can see nothing crazy...
views/users/index.html.erb
views/users/_user.html.erb
three backticks, and then language
thanks i'm not sure how to make it colored though? i used three backticks
you have to add the language after the three backticks
so
ruby
in this caseRAILS_SERVE_STATIC_FILES is enabled
I am unsure that
erb
works.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 😦
One last thing, Project ID?
(cmd + k/ctrl + k) -> project id'
that way I can look into your logs
Is project ID sensitive?
wdym
its a UUID
not like a password or anything, no other user can do anything with that information
ok thanks - 83791c3c-35a4-439c-96ea-34c41b9aed33
looking
Unrelated: You really shouldn't be using the Heroku buildpacks, those are going away in a week
I am looking into why that build is failing in the first place
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
Gotcha- we actually have a community member working on a Rails walkthrough doc haha
I am not a Rails dev but used to be one, so I can work my way through Ruby
also, I notice that a lot of Rails dev are having issues on here, so REALLY committed to fixing that experience
Can you do me a favor, slam through another
railway up
in your terminal?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
I can understand that frustration, very sorry.
Lets get you on some good footing.
did it
lmk when you have kicked this off.
cool, looking
build failed
expected, debugging
strange its complaining about:
#9 4.067 E: Unable to locate package libimagemagick-dev
but you have the right vars
Roping in another engappreciate it
can you add a file called
nixpacks.toml
with the contents:
then slam a up
afterto the top level of the project?
yes
It seems to be an issue with Imagemagick and the package deps it needs
(for builds)
then I think this would solve the other issue too
Because another usr reported an issue with the other buildpack messing with the templates, but this is a guess
added
cool watching
var conflict, fixing
Okay, taking longer, this is good
hehe
anything different is good...
yep, totally fresh install
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
ok let's see
still empty
ok
lets see
still looking
so for some reason, it can't find these Gems, thats why its triggering the error
Working with our Nixpacks eng, one sec
also tagging someone who might know
cc @wyzlle
Flagging this thread. A team member will be with you shortly.
Found a typo in the gemfile, updating and deploying again
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Hi
Now for some reason it's installing ruby and doing a whole lot of stuff it didn't in previous deploys.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
same issue
We have a hunch on what it might be.
going to switch ya back to Heroku stuff just so we can fix issue #1 :'P
At least we caught this.
Re-building
One second reverting that change
deployed again with gemfile fixed
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
gem env
Good news that the latest build succeeded. Bad news that the original issue is still happening :/
Lets fix that now
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
I don't know how to convert to nixpacks
When do you think the documentation will be ready for that?
Well, it should just be slot in
so the issue is on our end
luckily we have Jr working on that now
Meaning Nixpacks should be slot in?
Yes
so anything less than that is a failiure on our part
what would help for debuggin if the repo was made public
that way our eng can test it if you are comfortable with that
I prefer to keep the repo private for now
Understood, and entirely valid
But I am happy to spend time with your team as a test case for buildpacks -> nixpacks if that helps... certainly it's in my interest to make it work
its ours too 🙂
tagging in @coffeecup so he can engage with your when its time to debug
Thanks - really appreciate your time here
no problem, we will stop at nothing to have the best deployment platform
I am sorry that you are even facing these issues
Well I just solved the original issue - a stupid error on my end not related to Railway 🤦♀️ . In any case I'm signing off for the evening (it's 10:30pm in my timezone) but I look forward to solving the nixpacks issue and will check back into discord tomorrow. Thanks again
You must set your timezone first!
oh wow
bad Percy!
Hey @beccamay - we may have found the fix on our end.
Can ya try with NixPacks as soon as you are ready?
Hi, I tried moving to Nixpacks again this morning and the build failed.
Could it be something to do with the build command?
I'm going to clean up the repo a bit today and then can make it public for your team to debug.
I created a clean public repo for debugging, build failed with nixpacks. Project ID: d941b58d-50f1-4214-9388-7bebb28037f7
I noticed someone else solved their migration from heroku by overriding the build command (as I suspect I might need to do) here https://discord.com/channels/713503345364697088/1040204775838457907/1040204775838457907. But I'm not sure what the command should be in my case (Rails 7).
Discord
Discord - A New Way to Chat with Friends & Communities
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
Hey @beccamay, I believe the issue is with the
nixpacks.toml
file that you have. Can you remove it and try redeploying again.
We've fixed Nixpacks so that it will install the proper imagemagick dependencies without you needing to do anything custom. And the nixpacks config file you have currently is overriding the bundle install commandBuild was successful! 🎉 However the deployment takes over 5 minutes, compared with less than 1 minute with Heroku. Any way to speed it up?
We are aware of the slowness with Ruby builds and are working on improving it. Subsequent builds should be faster as they will take advantage of the build cache