#Custom build script crashing

31 messages · Page 1 of 1 (latest)

rain warren
#

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

viral ravenBOT
#

Project ID: 75979406-ee6e-4e85-858d-b7841574de4c

rain warren
#

75979406-ee6e-4e85-858d-b7841574de4c

#

I also have a monorepo level build command and have already tried it but didn't have any success

brisk citrus
rain warren
#

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

#

I've managed to get it running like so

brisk citrus
#

now you mentioned you currently only have one app in this monorepo, I'm assuming at some point you will add another app?

rain warren
#

Sadly any mention of pnpm would break the build process

#

Yes you're right, at some point I will have more apps

brisk citrus
#

will they import packages from one another?

rain warren
#

Yes most likely

brisk citrus
#

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

rain warren
#

Sure, trying that now

#

But I don't understand why that would be an issue now since I only have one app

#

Also, for the Custom Build & Deploy command, do I use npm or can I use pnpm?

brisk citrus
#

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

rain warren
#

Will try to run it with pnpm instead of npm run

#

Trying it out like so

#

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

#

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

brisk citrus
#

awesome and now the railway side of things is setup correctly too

#

probably a bit of both

rain warren
#

Well, I'm all happy now that it works so your input is very much appreciated