R
Railway14mo ago
Shen

Successfull deployment but application fails

I'm simply updating an already working application with an extra feature. Locally, my code works but after I push it's giving me a non-sensical error about an error in the code that's been completely changed. I checked my github and the changes have indeed gone through so this error doesn't make sense for that specific line. It seems like railway isn't properly reading the changes and while the build succeeds, I'm still getting node errors in the console when I try to use it... Project ID: 12056307-55fc-4d50-8c3a-efced5c393b2 The error in the provided screenshot doesn't make sense because I no longer have a data.forEach function in my repo entirely on that line. I changed the code to something different... I would appreciate any help I can get for this. I'm not sure if this is my fault or something going wrong between railway and github.
No description
Solution:
look into using vite, when vite bundles the app it appends a hash onto the assets filenames, when this hash changes it will invalidate the cache and your cache will clear automatically, you aren't doing that with just plain files
Jump to solution
25 Replies
Percy
Percy14mo ago
Project ID: 12056307-55fc-4d50-8c3a-efced5c393b2
Shen
ShenOP14mo ago
Update: I double checked that the error isn't on my end by uploading that same repo onto github pages. The functionality works fine without error and on the same commit that railways is supposedly pulling from. So I think I've confirmed that the issue isn't on my side but on railway's
Fragly
Fragly14mo ago
What version of node are you running locally?
Brody
Brody14mo ago
fragly this is a console error from a browser though you kinda have the right idea @Shen what kind of frontend app is this?
Shen
ShenOP14mo ago
Just a basic html/JS frontend. It makes a network request to an api end point, gets data from it and does stuff with the data then displays it It was working for months, but this latest change I made broke it but only on railway. The same exact code is working just fine on GitHub pages and locally on my machine It’s looking like railway isn’t updating properly Even it’s rebuilding and redeploying when I push new changes
Brody
Brody14mo ago
basic html/js? no framework of any kind like react? do you use a bundler like vite?
Shen
ShenOP14mo ago
Nope No frameworks or bundlers. It has 2 JS files and an html file and some pictures folder And css
Brody
Brody14mo ago
can you share your repo?
Shen
ShenOP14mo ago
One sec
Shen
ShenOP14mo ago
GitHub
GitHub - ShenPrime/Ali-DB-frontend
Contribute to ShenPrime/Ali-DB-frontend development by creating an account on GitHub.
Shen
ShenOP14mo ago
you can see in my commit history that the last several commits were just minor changes to the code in an effort to fix what I thought was a JS logic bug on my end
Brody
Brody14mo ago
can you try setting a NIXPACKS_NO_CACHE service variable to 1 and then let it rebuild
Shen
ShenOP14mo ago
Ah. So it's a cache issue? It's rebuilding from a cache? Is this in the service settings?
Brody
Brody14mo ago
that's my running theory, I don't have anything to back that up though service variables as previously mentioned
Shen
ShenOP14mo ago
Alright it's rebuilding. might take some minutes. Took over 3 minutes to rebuild this time while before it was taking around 1.5, but still the same result and the same error in the console
Brody
Brody14mo ago
can you clear your browser cache then?
Shen
ShenOP14mo ago
That did it. Thank you!
Brody
Brody14mo ago
and you thought it was a railway issue
Shen
ShenOP14mo ago
Not sure why the cache was an issue though because part of the html did update on the frontend
Solution
Brody
Brody14mo ago
look into using vite, when vite bundles the app it appends a hash onto the assets filenames, when this hash changes it will invalidate the cache and your cache will clear automatically, you aren't doing that with just plain files
Brody
Brody14mo ago
this means you can remove that service variable
Shen
ShenOP14mo ago
I see. I didn't think I'd need to resort to something like Vite for just a simple frontend like this
Brody
Brody14mo ago
the file hash is more useful than you'd think, not a problem with railway
Shen
ShenOP14mo ago
Was misleading for me cause using Github pages worked fine and it never occured me that it was a local caching issue lesson learned, I guess Thanks a lot for your help
Brody
Brody14mo ago
no problem!
Want results from more Discord servers?
Add your server