#Service using much more RAM on Railway than Local

20 messages · Page 1 of 1 (latest)

blazing surge
deep chasmBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

cinder canopyBOT
#

Project ID: b820c80e-50e9-475a-85c6-89832fccdd8c

blazing surge
#

b820c80e-50e9-475a-85c6-89832fccdd8c

gilded flint
#

what kind of app is it, besides bun

blazing surge
# gilded flint what kind of app is it, besides bun

Its a discord bot, here is the package.json

{
  "name": "discord-bot",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "type": "module",
  "scripts": {
    "start": "node --experimental-specifier-resolution=node --loader ts-node/esm src/index.ts",
    "dev": "concurrently \"nodemon --exec node --experimental-specifier-resolution=node --loader ts-node/esm src/index.ts\"",
    "build": "tsc",
    "bun-run": "bun --bun run src/index.ts"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@prisma/client": "^5.4.2",
    "bun": "^1.0.7",
    "colors": "^1.4.0",
    "discord.js": "^14.12.1",
    "express": "^4.18.2",
    "jimp": "^0.22.10",
    "paypal-invoices": "^1.5.0",
    "qrcode-reader": "^1.0.4",
    "stripe": "^13.10.0",
    "ts-node": "^10.9.1"
  },
  "devDependencies": {
    "@types/node": "^20.8.3",
    "concurrently": "^7.3.0",
    "nodemon": "^3.0.1",
    "prisma": "^5.4.2",
    "typescript": "^5.2.2"
  }
}
gilded flint
#

railway uses the start script by default, but you aren't using the start script when testing locally

blazing surge
#

I changed the railway default so it is npm run bun-run

gilded flint
#

have you tested your app locally in a docker container too?

blazing surge
#

Ill try that and get back to you

gilded flint
#

@simple orbit - the something to do with bun

simple orbit
#

Ah yep let me look at this on my laptop

#

can you please change your start script to this and let me know what version it prints out? please do this locally and for railway.
if there's a version mismatch that may be the issue here as they've been fixing a fair few memory issues recently.

bun --revision && bun run src/index.ts

gilded flint
#

@blazing surge

blazing surge
#

My local is 1.0.7+b0393fba6200d8573f3433fb0af258a0e33ac157, for some reason the command on railway didnt print anything. Another strange thing I noticed was when I switched to node the memory on railway went down from 1.4gb to around 800mb while on my local node uses more memory than bun.

gilded flint
#

the increased memory usage is likely due to the difference in bun versions and environments

simple orbit
blazing surge
simple orbit
#

yep that's probably part of the issue then. i personally run a Dockerfile to make sure im on the latest version of bun because of this.

blazing surge
#

Yeah not sure why the latest bun npm release tagged 1.0.7 is actually 1.0.2