API hanging and becoming unresponsive

5 months ago

I'm doing an auth server with better-auth using bun and hono, the project works fine locally, on docker and on cf workers but not on railway.

It's a super simple api with just some auth endpoints that are injected by better-auth
https://github.com/kadumedim/auth-server

If I hit any of those endpoints with my httpie the api becomes unresponsive and I'm wondering why this happens, seems like it's using railpack to build but I don't think this is the issue.

0 Replies

5 months ago

61e8a6cb-cf14-46b3-b9c7-02bd72e95922


5 months ago

is it listening on 0.0.0.0?


5 months ago

yes king, I can do requests fine but If I hit one of the auth endpoints it goes boom


5 months ago

i cant even hit / ?


5 months ago

502 after our request timeout


5 months ago

🤨


5 months ago

well now i can, since you just redeployed


5 months ago

oh mb I commited some changes


5 months ago

it prob was in that crashed state


5 months ago

there is this

1348848725203747000


5 months ago

yep, thats him


5 months ago

OOM


5 months ago

it starts eating up ram in the crashed state


5 months ago

1348849362712924200


5 months ago

its being built with nixpacks, mind switching to railpack?


5 months ago

what is railway doing different than other providers… I did some verbose logging in the pg connection and it doesn't even starts a client, it crashes before that


5 months ago

sure


5 months ago

failed on the pre deploy command because it needs python


5 months ago

it's just some migrations, i will remove it just for testing


5 months ago

same thing <:cryingman:786867299553378324>


5 months ago

something is pinning it at the max 1 vcpu


5 months ago

but I don't think that's the issue here


5 months ago

max since bun / node is single threaded


5 months ago

it is a issue


5 months ago

gotta find out what better auth is doing to pin your cpu at 1


5 months ago

er uhm


5 months ago

it was nixpacks and railpack


5 months ago

using a dockerfile worked flawlessly


5 months ago

share the Dockerfile?


5 months ago

super simple dockerfile, copied it from our bun-hono template


5 months ago

FROM oven/bun:1.2.5 as builder

WORKDIR /app

# Copy package.json and bun.lock
COPY package.json bun.lock ./

# Install dependencies
RUN bun install --frozen-lockfile

# Copy the rest of the application
COPY . .

# Build the application
RUN bun run build

# Production stage
FROM oven/bun:1.2.5-slim

WORKDIR /app

# Copy the built application from the builder stage
COPY --from=builder /app/server ./server

# Command to run the application
CMD ["./server"]

5 months ago

very interesting


5 months ago

indeed


5 months ago

any clue why?


5 months ago

absolutely no clue 😦


API hanging and becoming unresponsive - Railway Help Station