Railpack & Bun Monorepos not using bun to install
rekkisomo
PROOP

a month ago

why is railpack still allergic on using bun in monorepos…? forcing it to run bun install runs it in god knows what directory that doesnt have a package.json (even though every project folder HAS one)

i swear this has been an issue for so long because it expects a bun.lock in the project's directory, not the monorepo root.

Solved

15 Replies

rekkisomo
PROOP

a month ago

I've been dealing with this for over an hour and its 3am.

There was a stray yarn reference which I removed, but its still occurring (albeit differently?)

npm is now being used to install. bun is used to run, but now I just get Cannot find module '.prisma/client/default' from '/app/node_modules/@prisma/client/default.js' which wasn't happening at all before.

Service a007e3cf-5cec-4e60-af75-372fb8408840
Env e3c3b3a6-60cd-4333-bdcb-90028ab81029
Build ae7a4949-5c1e-4943-8e62-18980bf74235

Should be building in /apps/server, bun.lock is in / (where bun puts it normally for monorepos). I only want railway to use the server. I don't know where forcing bun install in railpack.json is running it in where a package.json doesn't exist.

1461396565582418000


uxuz
MODERATOR

a month ago

I'll escalate this thread to the team for further attention. If you need a solution right now, then it is best to write a custom Dockerfile.


uxuz
MODERATOR

a month ago

!t


uxuz
MODERATOR

a month ago

This thread has been escalated to the Railway team.

Status changed to Awaiting Railway Response uxuz about 1 month ago


rekkisomo
PROOP

a month ago

-# perfect timing as im writing
I managed to make a copy of the project's lockfile, shoved it in /apps/server, and its working now, but this may get a bit annoying to have to do every time.

We did initially use a custom Dockerfile but we were hoping to use Railpack instead, i guess we'll have to hold out for now?


uxuz
MODERATOR

a month ago

Would it be possible for you to provide a minimal reproducible example that would lead to this behavior of Railpack?

While not ideal, it is perhaps best to use a Dockerfile for now.


rekkisomo
PROOP

a month ago

Sure thing, but I won't have time to until later tomorrow (AEDT). Will get back to you on that.

> While not ideal, it is perhaps best to use a Dockerfile for now.
feared so, but oh well.

Thanks 🫡


brody
EMPLOYEE

a month ago

Hey Rek, would you happen to have a MRE for this? Happy to look into how we could make the experience better!


iloveitaly
HOBBY

a month ago

Yeah, something is definitely off here. Could you give me a tree output or general description of your project structure so I can try to reproduce on my end?

Would love to work with you to fix the experience here. We have some tests around workspaces on pnpm and npm, but not bun, so definitely need to improve what we are doing here.


iloveitaly
HOBBY

a month ago

re: dockerfile, if you can hold off a couple days, I can work with you on this to get it fixed in railpack so you don't have to worry about a Dockerfile 🙂


Status changed to Awaiting User Response sam-a about 1 month ago


iloveitaly
HOBBY

a month ago

@Rek I put together a test case for a bun workspace: https://github.com/railwayapp/railpack/pull/430. It's working fine, so there's some complexity I need to add from your situation.

Looking at your plan, it seems like your package.json looks like it has yarn defined as the package manager. Is that a mistake?


rekkisomo
PROOP

a month ago

Hey! I'm not available for a bit, so sorry it's gonna be a little.

The yarn reference was removed (as said earlier) but that just made it use NPM instead.

There's probably something stupid I'm missing but won't be able to fully play around until later tomorrow. The project is private, but I can give access to it (or give a source ZIP) if that'd help more.


rekkisomo
PROOP

a month ago

I'm on mobile so forgive the jank formatting. Thinking about it, there might be something goofy as the project is a bit of a mess (prototype wasn't too long ago)

  • The root contains the bun.lock with an /apps and /packages. Everything in the project uses Bun.

  • Railway is set to watch and use /apps/server, using Railpack with Metal off - there was no difference with it on

  • The server did briefly mention yarn which was removed shortly after making this thread, but that still made it only detect node.

  • The server runs for the most part, but there's some packages that were a little broken I had to work around as they were installed a bit odd (Sinclair's typebox for elysia was one)

1461541972337492200
1461541972627161000


rekkisomo
PROOP

a month ago

Are we deadass

Someone else caught this and I swear I tried that but it did nothing 😭

1461543241554985200


rekkisomo
PROOP

a month ago

it's using bun to install and ISNT complaining about no package.json now (still don't know what was up with that though)

I wasted so much time on this and ended up wasting yours a bit <:kms:377718110549049344>

I still think it should at least detect the workspace root package like CF, though.


iloveitaly
HOBBY

a month ago

@Rek yeah, if I could get access to the sourcecode that would be helpful (I'm iloveitaly on github). Otherwise, the full package.json would be really helpful to look at.

The bun.lock file alone should cause bun install to be used.

Couple questions:

  1. All packages/apps are using bun, right?

  2. The root folder is what determines which package manager is used. In the SS you have a package.json and bun.lock. That is in the root folder where the builder is running, correct? If so, bun should be picked up.

  3. Is there a package-lock.json anywhere?

  4. Do you have any RAILPACK_ env vars set on your deploy?


Railway
BOT

23 days ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 23 days ago


Loading...