R
Railway8mo 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
Percy8mo ago
Project ID: e6e9a6da-436a-4fd9-8b55-56549881bc41
shaoruu
shaoruu8mo ago
e6e9a6da-436a-4fd9-8b55-56549881bc41
Brody
Brody8mo ago
what version of yarn are you using locally
shaoruu
shaoruu8mo ago
I'm using 1.22.19
Brody
Brody8mo ago
what version is railway using
shaoruu
shaoruu8mo ago
I'm not sure hot to check. How should I check?
Brody
Brody8mo ago
it would be in the build table at the top of the build logs
shaoruu
shaoruu8mo ago
Is it this?
No description
shaoruu
shaoruu8mo ago
No description
Brody
Brody8mo ago
yarn 1x can you run yarn run build locally without issues?
shaoruu
shaoruu8mo ago
lemme double check yup it works
Brody
Brody8mo ago
what version of node are you using locally?
shaoruu
shaoruu8mo ago
v18.16.0
Brody
Brody8mo ago
do you have the railway cli installed locally?
shaoruu
shaoruu8mo ago
yes, i use railway up to deploy
Brody
Brody8mo ago
your service has a github icon?
shaoruu
shaoruu8mo ago
yup, it does does that entail anything?
Brody
Brody8mo ago
is date-fns a npm package?
shaoruu
shaoruu8mo 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
Brody8mo 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
shaoruu8mo ago
let me give it a try
Brody
Brody8mo ago
specifically installing with the same frozen lock file flag railway uses
shaoruu
shaoruu8mo ago
yup, it works hmmm
Brody
Brody8mo ago
you tried those steps with the frozen lock file?
shaoruu
shaoruu8mo ago
yup, it works locally is anybody also getting similar errors?
Brody
Brody8mo ago
nope, this isnt a railway issue, I assure you
shaoruu
shaoruu8mo ago
the weird thing is
Brody
Brody8mo ago
I'm not saying it's not weird
shaoruu
shaoruu8mo ago
i tried deploying to staging and it's working
Brody
Brody8mo ago
delete your lock file, delete node_modules, regen your lock file, try the local build again
shaoruu
shaoruu8mo ago
just tried it out, it works 🤔
Brody
Brody8mo ago
what did you change lol
shaoruu
shaoruu8mo ago
nono i meant, the local build works
Brody
Brody8mo ago
I know
shaoruu
shaoruu8mo ago
i deleted the lock file, deleted node modules, and did "yarn" "yarn build"
Brody
Brody8mo ago
I'm asking what you changed that resulted in Railway failing to build
shaoruu
shaoruu8mo ago
let me check
Brody
Brody8mo ago
and can you provide the build logs for the last successful deploy https://bookmarklets.up.railway.app/log-downloader/
shaoruu
shaoruu8mo ago
one line hahaha
No description
shaoruu
shaoruu8mo ago
here are the logs oh wait this is the deploy logs
Brody
Brody8mo ago
I have to ask, what's with all the [0] does it show up in railway like that?
shaoruu
shaoruu8mo 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
Brody8mo ago
do you have your backend api serving the frontend by chance?
shaoruu
shaoruu8mo ago
yup, the express app serves the react build ? is that no good?
Brody
Brody8mo 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
shaoruu8mo ago
i'm interested, what should i do?
Brody
Brody8mo ago
what does the structure of your repo currently look like, and if you can, could you share the repo?
shaoruu
shaoruu8mo 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
Brody8mo ago
if you'd be okay with that, yes, it would help me help you structure the repo correctly
shaoruu
shaoruu8mo 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
Brody8mo ago
nope, just need to get a lay of the land brody192 is my gh username
shaoruu
shaoruu8mo ago
just sent an invite, did you get it?
Brody
Brody8mo ago
indeed looking now
shaoruu
shaoruu8mo ago
thanks for your help so far 🙏
Brody
Brody8mo 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
shaoruu8mo 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
Brody8mo ago
then you want a shared monorepo either way you shouldn't have the two services mushed together like you currently do
shaoruu
shaoruu8mo ago
why would that cause a problem?
Brody
Brody8mo ago
and its not very good practice to have the api serve the frontend
shaoruu
shaoruu8mo ago
really?
Brody
Brody8mo ago
i mean its just simply not the correct way to do it
shaoruu
shaoruu8mo ago
hm, so how should it be separated?
Brody
Brody8mo 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
shaoruu8mo ago
never heard of that, what does that do?
Brody
Brody8mo ago
helps you manage a shared monorepo