R
Railway

✋|help

Bun 1.0 on railway

D.dylangm9/10/2023
I am spinning up a simple bun app with 1 file in it. But for some reason all of my builds are failing.
I am using bun build ./index.tsx --outdir ./build from bun's documentation to build.
This is my service ID: b741e4ae-cac8-410f-a15a-be6e2551fa96
Any help would be appreciated.
Ffedev1009/10/2023
just directly run index.tsx with bun, it supports typescript
  "scripts": {
    "start": "bun ./index.tsx"
  },
D.dylangm9/10/2023
And this is the build command or the start?
Ffedev1009/10/2023
start in the package json
Ffedev1009/10/2023
do you have theese empty?
D.dylangm9/10/2023
I do now, before I had bun build and bun index.ts there
Ffedev1009/10/2023
try adding only start in package and leaving those empty
D.dylangm9/10/2023
So add, "start package.json" for the start command? Or do I put bun ./index.tsx because I have tried those and they failed
Ffedev1009/10/2023
can you send your package.json?
D.dylangm9/10/2023
{
  "name": "andromeda-backend",
  "module": "index.ts",
  "type": "module",
  "devDependencies": {
    "bun-types": "latest"
  },
  "scripts": {
    "start": "bun ./index.tsx"
  },
  "peerDependencies": {
    "typescript": "^5.0.0"
  }
}
Ffedev1009/10/2023
have you tried deploying it like this?
D.dylangm9/10/2023
I have been trying with this package.json the whole time
Ffedev1009/10/2023
have the same settings and it works for me
have you initialized with bun init?
Rroot9/10/2023
If that doesn't work, you could try removing all of your custom configuration.
Make sure you've run bun install and are committing your bun.lockb.
D.dylangm9/11/2023
I have run bun init, and bun run index along with bun install. I have it working just fine on my local.
This is the error from railway #10 0.237 /bin/bash: line 1: npm: command not found #10 ERROR: process "/bin/bash -ol pipefail -c npm ci" did not complete successfully: exit code: 127
IImLunaHey9/11/2023
Had bun been updated to 1 in railway yet?
I’m still running my own dockerfile because of how out of date it was last time I checked.
Also why are you doing a build and not just bun run?
D.dylangm9/11/2023
Hi, where should I put bun run? In the start command?
IImLunaHey9/11/2023
Yes.
That’s what you’re using locally, no?
D.dylangm9/11/2023
And that would be the start command?
IImLunaHey9/11/2023
Yep. That’s all I use for my bun projects
D.dylangm9/11/2023
It is still failing with ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm ci" did not complete successfully: exit code: 127
IImLunaHey9/11/2023
There’s something you’re missing here. Npm shouldn’t be getting called?
Does it show the bun version in the railway logs by chance?
D.dylangm9/11/2023
It does not
║ setup      │ bun              ║

║ start      │ bun run index.ts ║

#3 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1693872184

#4 [stage-0  1/19] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1693872184@sha256:c90dd7da0f961900970339c955170d2c852fee6ba73ccd2c7895f1999ff92609

#10 [stage-0 6/8] RUN --mount=type=cache,id=s/b741e4ae-cac8-410f-a15a-be6e2551fa96-/root/bun,target=/root/.bun npm ci

> [stage-0 6/8] RUN --mount=type=cache,id=s/b741e4ae-cac8-410f-a15a-be6e2551fa96-/root/bun,target=/root/.bun npm ci:

20 | >>> RUN --mount=type=cache,id=s/b741e4ae-cac8-410f-a15a-be6e2551fa96-/root/bun,target=/root/.bun npm ci

This is all it says filtering for bun
This is an old project that I am converting to bun, it could be that is the issue.
Although I created a new project and it also failed to build
D.dylangm9/11/2023
It does, I looked at the link and I don't have node in my package.json
IImLunaHey9/11/2023
okay, try using that newer nixpack and see if that helps
otherwise you could always add a Dockerfile similar to this. might need to change a few things.

FROM oven/bun

WORKDIR /app

COPY src /app/src
COPY bun.lockb package.json tsconfig.json /app/

RUN bun i

CMD bun run start
D.dylangm9/11/2023
still failing with
Dockerfile:20

-------------------

18 |     ENV NIXPACKS_PATH /app/node_modules/.bin:$NIXPACKS_PATH

19 |     COPY . /app/.

20 | >>> RUN --mount=type=cache,id=s/b741e4ae-cac8-410f-a15a-be6e2551fa96-/root/bun,target=/root/.bun npm ci

21 |

22 |     # build phase

-------------------

ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm ci" did not complete successfully: exit code: 127

 

Error: Docker build failed
IImLunaHey9/11/2023
lol why it it using npm 🤦‍♀️
@Brody is the nixpack for bun using npm? 🤔
D.dylangm9/11/2023
I just added the .toml file, is there a way to change it from there?
BBrody9/11/2023
just looks like nixpacks is detecting node instead of bun
IImLunaHey9/11/2023
@.dylangm do you a commited bun lock file in your repo? 🤔
BBrody9/11/2023
Rroot9/11/2023
no
BBrody9/11/2023
please follow the 3 steps
D.dylangm9/11/2023
My browser isn't letting me add it as a bookmarklet, it's just working like a usual bookmark
Rroot9/11/2023
You dragged the "Download Logs" button to your bookmarks bar?
D.dylangm9/11/2023
I feel like the link could be more clear for idiots like me
BBrody9/11/2023
Drag this link to your bookmarks bar
but hey congrats
IImLunaHey9/11/2023
lol what. nixpacks you're drunk.

║ setup │ bun ║
║───────────────────────────────║
║ install │ npm ci ║
Rroot9/11/2023
hrrrm
BBrody9/11/2023
what indeed
Rroot9/11/2023
You have no custom configuration whatsoever?
BBrody9/11/2023
any railway.json?
Rroot9/11/2023
any nixpacks.toml?
anything in the service settings?
IImLunaHey9/11/2023
"maybe" 😅
D.dylangm9/11/2023
Only added the .toml file luna suggested,
[phases.setup] nixpkgsArchive = 'c054b2a07bce2be3b85fed85f45aea6a4b97f5cc'
Rroot9/11/2023
hmmm
D.dylangm9/11/2023
There's no railway.json in my project, here is the repo https://github.com/DylanBozarth/Andromeda-Backend
Rroot9/11/2023
Remove package-lock.json
BBrody9/11/2023
i was typing that lol
speed
IImLunaHey9/11/2023
the instant brain sync 😆
also you'll likely want to set the port to use process.env.PORT not hardcode it to 2999.
D.dylangm9/11/2023
Wow, it looks like it worked.
So was the package-lock left over from the node project?
IImLunaHey9/11/2023
yep
D.dylangm9/11/2023
Wow, I tried everything but that because I'm so used to seeing that in a project
BBrody9/11/2023
luna is right, this is important, please dont forget
D.dylangm9/11/2023
Thank you all for your help.

Looking for more? Join the community!

Recommended Posts
Socket cannot be archivedWhen building the railway project I get a message saying that: /Users/x/Library/Application SupportBUN 1.0 + AstroHas anyone tried to deploy a Bun app yet? I am getting this error. ERROR: failed to solve: processDjango Railway admin consoleHi! I've had a really good time using Railway thus far, sea-change from setting up an EC2 instance Trouble sending emails via SMTPprojectId: `bb66f5c0-53f9-4e9f-b11f-5965f5d6ec74` serviceId: `b3029692-b78a-4487-bcb0-44e001afecb8` Cannot have a TCP proxy and a domainWhen trying to create a service with a proxy, I'm getting this error. Can I not have a TCP proxy serChange region for Postgres DatabaseHey ! Congratulations for the launch of deployment region ! Now, how can I migrate my db to another Connection Pooling or PgBouncer for Postgres Instances?Hello! Anyone know if the Railway Postgres instance has any sort of connection pooling or pgBouncer?webhook to rebuild serviceHi I have one project: Mongo, PayloadCMS + storage, Nextjs I want to trigger nextjs rebuild after aI paid 40 dollars in subscription fees but its still dont pay my debt for credits.deploy prisma/client not foundhey, when I deploy the prisma client in node_modules is not found because its not generating, I haveCan you explain how usage is estimatedI have an account with a hobby plan subscription, I have a discord bot running on it and a MySQL DB Trying to save a fileTrying to save a file in media/ where can i save files ? PermissionError: [Errno 13] Permission dHelp setup a monorepo - Angular / ExpressHi! Hope everyone is doing well :). I am trying to deploy my Angular application on railway, but it Nose.Js versionhow do i change itVolume creation prevents service from deployingHi! I'm trying to add a volume to a project, but when I attach it to the service, it stops being abldeploy bun 1.0 projectdoes anyone know if and how thats possible on railway currently?Random CPU spike and unresponsive serverWe switched from Vercel to Railway one week ago, and everything was going well until today. For somIncorrect hostname with private networkingI've set `mongo-2.railway.internal` (or mongo-2) as the endpoint name for private networking on the Do I need to configure anything in the Docker Image to support TCP proxy?For some reason I can't use the TCP proxy in the Minecraft Server template, I get "connection reset"Cron JobsHey everyone. I'm moving from Vercel to Railway so this is my first Railway project. I'm trying to i