R
Railway•9mo ago
r9d7

Custom build script crashing

Failing to build my monorepo project with a custom build script (was working fine with the defaults). My monorepo has only one app at /apps/web-app (which I set up as the Root Dir on Railway). I have a Postgres service running as well, and I need to run the migrations from my monorepo there, so I added a custom script in my web-app/package.json (see 1st screenshot), then added my custom build command (see 2nd screenshot) but it's crashing the build
No description
No description
24 Replies
Percy
Percy•9mo ago
Project ID: 75979406-ee6e-4e85-858d-b7841574de4c
r9d7
r9d7OP•9mo ago
75979406-ee6e-4e85-858d-b7841574de4c
r9d7
r9d7OP•9mo ago
I also have a monorepo level build command and have already tried it but didn't have any success
No description
Brody
Brody•9mo ago
it's very hard to help with your issue when we aren't told the issue, please provide your build logs with this https://bookmarklets.up.railway.app/log-downloader/
r9d7
r9d7OP•9mo ago
Apologies, hope this helps
r9d7
r9d7OP•9mo ago
I've been trying to solve the issue for the past 20 min or so but I'm hoping the bookmark extracted the correct logs
r9d7
r9d7OP•9mo ago
I've managed to get it running like so
No description
Brody
Brody•9mo ago
now you mentioned you currently only have one app in this monorepo, I'm assuming at some point you will add another app?
r9d7
r9d7OP•9mo ago
Sadly any mention of pnpm would break the build process Yes you're right, at some point I will have more apps
Brody
Brody•9mo ago
will they import packages from one another?
r9d7
r9d7OP•9mo ago
Yes most likely
Brody
Brody•9mo ago
then you can't set a root directory because only the set directory will be copied in meaning you can't import anything from the other packages because they won't be in the image so please set the root directory back to the root and set your applicable build and start commands that are filtered to run the build and start commands of your web-app
r9d7
r9d7OP•9mo ago
Sure, trying that now But I don't understand why that would be an issue now since I only have one app
r9d7
r9d7OP•9mo ago
Also, for the Custom Build & Deploy command, do I use npm or can I use pnpm?
No description
Brody
Brody•9mo ago
you're right it wouldn't the issue right now, but it sure will be when you add more apps to the monorepo, so I believe it's best to start off with the correct setup npm or pnpm depends on what you use locally
r9d7
r9d7OP•9mo ago
It is failing again 😦
r9d7
r9d7OP•9mo ago
Will try to run it with pnpm instead of npm run
r9d7
r9d7OP•9mo ago
Trying it out like so
No description
No description
r9d7
r9d7OP•9mo ago
The prev build had the same scripts in the root package.json, the only difference was that the custom build & start commands were using npm run instead of pnpm
r9d7
r9d7OP•9mo ago
r9d7
r9d7OP•9mo ago
Oops gimme 2 sec, just realised I had forgotten to push my changes after committing Looks like its working now, sorry for the stupid mistakes And thank you for your time. Your suggestion about the monorepo setup is what fixed it I think
Brody
Brody•9mo ago
awesome and now the railway side of things is setup correctly too probably a bit of both
r9d7
r9d7OP•9mo ago
Well, I'm all happy now that it works so your input is very much appreciated
Brody
Brody•9mo ago
happy to help!
Want results from more Discord servers?
Add your server