Next.js App Access Issue - App ID ebee6730-760d-43e2-ae2a-9b3900744448

wilsntn
PRO

2 months ago

Hello,

I am writing to report an issue I'm having with my Next.js application, which is deployed on Railway. I'm unable to access the app using my custom domain, even though the deployment seems to be running correctly.

Here are the details of my setup:

Dockerfile:

Dockerfile

##### DEPENDENCIES
FROM --platform=linux/amd64 node:lts-alpine AS deps
RUN apk add --no-cache libc6-compat openssl
WORKDIR /app
COPY prisma ./
RUN npm install -g pnpm;
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN \
    if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
    elif [ -f package-lock.json ]; then npm ci; \
    elif [ -f pnpm-lock.yaml ]; then npm install -g pnpm && pnpm i; \
    else echo "Lockfile not found." && exit 1; \
    fi
##### BUILDER
FROM --platform=linux/amd64 node:20-alpine AS builder
ARG DATABASE_URL
ARG NEXT_PUBLIC_CLIENTVAR
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN \
    if [ -f yarn.lock ]; then SKIP_ENV_VALIDATION=1 yarn build; \
    elif [ -f package-lock.json ]; then SKIP_ENV_VALIDATION=1 npm run build; \
    elif [ -f pnpm-lock.yaml ]; then SKIP_ENV_VALIDATION=1 pnpm run build; \
    else echo "Lockfile not found." && exit 1; \
    fi
##### RUNNER
FROM --platform=linux/amd64 gcr.io/distroless/nodejs20-debian12 AS runner
WORKDIR /app
ENV NODE_ENV production
COPY --from=builder /app/next.config.ts ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
EXPOSE 3000
ENV PORT 3000
CMD ["server.js"]

Logs:

The application appears to be starting correctly, and the logs show that it is listening on port 3000:

Starting Container
   ▲ Next.js 15.4.6
   - Local:        http://8ef088d9d8c2:3000
   - Network:      http://8ef088d9d8c2:3000
 
 ✓ Starting...
 ✓ Ready in 120ms

Despite the container running and listening on the correct port, I cannot access the application via the custom domain I configured. I would appreciate any help in troubleshooting this issue.

Thank you,

Solved

3 Replies

Railway
BOT

2 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


parmstar
EMPLOYEE

2 months ago

Are you declaring port 3000 in your code? Can you instead use the $PORT variable?

https://docs.railway.com/guides/public-networking#railway-provided-port


Status changed to Awaiting User Response Railway 2 months ago


wilsntn
PRO

2 months ago

Yea, but i solved changing my dockerfile. Thanks!


Status changed to Awaiting Railway Response Railway 2 months ago


Status changed to Solved wilsntn 2 months ago