R
Railway13mo ago
shaoruu

Running into build errors only on Railway

I am running into deployment failure that throws errors that I cannot reproduce locally. I have tried running Nixpacks locally and no errors were encountered either. What should I do?
No description
No description
66 Replies
Percy
Percy13mo ago
Project ID: e6e9a6da-436a-4fd9-8b55-56549881bc41
shaoruu
shaoruuOP13mo ago
e6e9a6da-436a-4fd9-8b55-56549881bc41
Brody
Brody13mo ago
what version of yarn are you using locally
shaoruu
shaoruuOP13mo ago
I'm using 1.22.19
Brody
Brody13mo ago
what version is railway using
shaoruu
shaoruuOP13mo ago
I'm not sure hot to check. How should I check?
Brody
Brody13mo ago
it would be in the build table at the top of the build logs
shaoruu
shaoruuOP13mo ago
Is it this?
No description
shaoruu
shaoruuOP13mo ago
No description
Brody
Brody13mo ago
yarn 1x can you run yarn run build locally without issues?
shaoruu
shaoruuOP13mo ago
lemme double check yup it works
Brody
Brody13mo ago
what version of node are you using locally?
shaoruu
shaoruuOP13mo ago
v18.16.0
Brody
Brody13mo ago
do you have the railway cli installed locally?
shaoruu
shaoruuOP13mo ago
yes, i use railway up to deploy
Brody
Brody13mo ago
your service has a github icon?
shaoruu
shaoruuOP13mo ago
yup, it does does that entail anything?
Brody
Brody13mo ago
is date-fns a npm package?
shaoruu
shaoruuOP13mo ago
i believe so, it's a dependency of another package react-day-picker was there any updates to railway? deployments were working perfectly last night and this morning i changed a minor detail to the code base and it stopped working so i suspect the issue is on railway's side
Brody
Brody13mo ago
there where no updates to nixpacks, this would be a code / config issue if you delete your local node_modules folder, reinstall the modules, and run another local build, does that succeed?
shaoruu
shaoruuOP13mo ago
let me give it a try
Brody
Brody13mo ago
specifically installing with the same frozen lock file flag railway uses
shaoruu
shaoruuOP13mo ago
yup, it works hmmm
Brody
Brody13mo ago
you tried those steps with the frozen lock file?
shaoruu
shaoruuOP13mo ago
yup, it works locally is anybody also getting similar errors?
Brody
Brody13mo ago
nope, this isnt a railway issue, I assure you
shaoruu
shaoruuOP13mo ago
the weird thing is
Brody
Brody13mo ago
I'm not saying it's not weird
shaoruu
shaoruuOP13mo ago
i tried deploying to staging and it's working
Brody
Brody13mo ago
delete your lock file, delete node_modules, regen your lock file, try the local build again
shaoruu
shaoruuOP13mo ago
just tried it out, it works 🤔
Brody
Brody13mo ago
what did you change lol
shaoruu
shaoruuOP13mo ago
nono i meant, the local build works
Brody
Brody13mo ago
I know
shaoruu
shaoruuOP13mo ago
i deleted the lock file, deleted node modules, and did "yarn" "yarn build"
Brody
Brody13mo ago
I'm asking what you changed that resulted in Railway failing to build
shaoruu
shaoruuOP13mo ago
let me check
Brody
Brody13mo ago
and can you provide the build logs for the last successful deploy https://bookmarklets.up.railway.app/log-downloader/
shaoruu
shaoruuOP13mo ago
one line hahaha
No description
shaoruu
shaoruuOP13mo ago
here are the logs oh wait this is the deploy logs
Brody
Brody13mo ago
I have to ask, what's with all the [0] does it show up in railway like that?
shaoruu
shaoruuOP13mo ago
I think that's the "concurrently" package, i used to build the extension and the web simultaneously but then I realized i didn't need to build the extension on railway so right now there's only 1 thing running concurrently
concurrently "yarn run build:web"
that's why [0] gonna remove that now hahaha i still don't quite get why it works on the staging environment though
Brody
Brody13mo ago
do you have your backend api serving the frontend by chance?
shaoruu
shaoruuOP13mo ago
yup, the express app serves the react build ? is that no good?
Brody
Brody13mo ago
would you be interested in me helping you setup your services properly? there's a good chance we fix what's wrong during that process
shaoruu
shaoruuOP13mo ago
i'm interested, what should i do?
Brody
Brody13mo ago
what does the structure of your repo currently look like, and if you can, could you share the repo?
shaoruu
shaoruuOP13mo ago
the only difference for this is that staging deploys automatically on branch change, which right now is set to the main branch you mean add you as a collaborator on the github repo?
Brody
Brody13mo ago
if you'd be okay with that, yes, it would help me help you structure the repo correctly
shaoruu
shaoruuOP13mo ago
would you need to run the project locally? since the project depends on some tokens to be set in the .env to run properly, i'm not sure if i can share them i could share the codebase though, do you have an email account that i can share to?
Brody
Brody13mo ago
nope, just need to get a lay of the land brody192 is my gh username
shaoruu
shaoruuOP13mo ago
just sent an invite, did you get it?
Brody
Brody13mo ago
indeed looking now
shaoruu
shaoruuOP13mo ago
thanks for your help so far 🙏
Brody
Brody13mo ago
so what you want is an isolated monorepo https://docs.railway.app/deploy/monorepo#isolated-monorepo but you currently have both apps mushed together, can you work at separating the separate services out into a respective backend and frontend folder?
shaoruu
shaoruuOP13mo ago
what if they do share code? i know it's bad but they are sharing some types and utility functions <:pepe_sweat:786868788560920576>
Brody
Brody13mo ago
then you want a shared monorepo either way you shouldn't have the two services mushed together like you currently do
shaoruu
shaoruuOP13mo ago
why would that cause a problem?
Brody
Brody13mo ago
and its not very good practice to have the api serve the frontend
shaoruu
shaoruuOP13mo ago
really?
Brody
Brody13mo ago
i mean its just simply not the correct way to do it
shaoruu
shaoruuOP13mo ago
hm, so how should it be separated?
Brody
Brody13mo ago
really, you want two railway services one for your frontend and one for your backend, but you need to properly structure your repo before you worry about that maybe you could use nx?
shaoruu
shaoruuOP13mo ago
never heard of that, what does that do?
Brody
Brody13mo ago
helps you manage a shared monorepo
Want results from more Discord servers?
Add your server