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.
Solution:Jump to 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
25 Replies
Project ID:
12056307-55fc-4d50-8c3a-efced5c393b2
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
What version of node are you running locally?
fragly this is a console error from a browser
though you kinda have the right idea
@Shen what kind of frontend app is this?
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
basic html/js? no framework of any kind like react? do you use a bundler like vite?
Nope
No frameworks or bundlers. It has 2 JS files and an html file and some pictures folder
And css
can you share your repo?
One sec
GitHub
GitHub - ShenPrime/Ali-DB-frontend
Contribute to ShenPrime/Ali-DB-frontend development by creating an account on GitHub.
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
can you try setting a
NIXPACKS_NO_CACHE
service variable to 1
and then let it rebuildAh. So it's a cache issue? It's rebuilding from a cache?
Is this in the service settings?
that's my running theory, I don't have anything to back that up though
service variables as previously mentioned
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
can you clear your browser cache then?
That did it. Thank you!
and you thought it was a railway issue
Not sure why the cache was an issue though because part of the html did update on the frontend
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
this means you can remove that service variable
I see. I didn't think I'd need to resort to something like Vite for just a simple frontend like this
the file hash is more useful than you'd think, not a problem with railway
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
no problem!