2 years 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.
35 Replies
2 years ago
61e8a6cb-cf14-46b3-b9c7-02bd72e95922
2 years ago
is it listening on 0.0.0.0?
2 years ago
yes king, I can do requests fine but If I hit one of the auth endpoints it goes boom
2 years ago
i cant even hit / ?
2 years ago
502 after our request timeout
2 years ago
๐คจ
2 years ago
well now i can, since you just redeployed
2 years ago
oh mb I commited some changes
2 years ago
it prob was in that crashed state
2 years ago
there is this

2 years ago
yep, thats him
2 years ago
OOM
2 years ago
it starts eating up ram in the crashed state
2 years ago

2 years ago
its being built with nixpacks, mind switching to railpack?
2 years 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
2 years ago
sure
2 years ago
failed on the pre deploy command because it needs python
2 years ago
it's just some migrations, i will remove it just for testing
2 years ago
same thing <:cryingman:786867299553378324>
2 years ago
something is pinning it at the max 1 vcpu
2 years ago
but I don't think that's the issue here
2 years ago
max since bun / node is single threaded
2 years ago
it is a issue
2 years ago
gotta find out what better auth is doing to pin your cpu at 1
2 years ago
er uhm
2 years ago
it was nixpacks and railpack
2 years ago
using a dockerfile worked flawlessly
2 years ago
share the Dockerfile?
2 years ago
super simple dockerfile, copied it from our bun-hono template
2 years 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"]2 years ago
very interesting
2 years ago
indeed
2 years ago
any clue why?
2 years ago
absolutely no clue ๐ฆ