API hanging and becoming unresponsive

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.

35 Replies

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


brody
EMPLOYEE

a year ago

is it listening on 0.0.0.0?


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


brody
EMPLOYEE

a year ago

i cant even hit / ?


brody
EMPLOYEE

a year ago

502 after our request timeout


🤨


brody
EMPLOYEE

a year ago

well now i can, since you just redeployed


oh mb I commited some changes


it prob was in that crashed state


brody
EMPLOYEE

a year ago

there is this

1348848725203747000


yep, thats him


brody
EMPLOYEE

a year ago

OOM


it starts eating up ram in the crashed state



brody
EMPLOYEE

a year ago

its being built with nixpacks, mind switching to railpack?


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


sure


failed on the pre deploy command because it needs python


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


same thing <:cryingman:786867299553378324>


brody
EMPLOYEE

a year ago

something is pinning it at the max 1 vcpu


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


brody
EMPLOYEE

a year ago

max since bun / node is single threaded


brody
EMPLOYEE

a year ago

it is a issue


brody
EMPLOYEE

a year ago

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


er uhm


it was nixpacks and railpack


using a dockerfile worked flawlessly


brody
EMPLOYEE

a year ago

share the Dockerfile?


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


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"]

brody
EMPLOYEE

a year ago

very interesting


indeed


any clue why?


brody
EMPLOYEE

a year ago

absolutely no clue 😦


Loading...