#502 when Deploying Payload CMS on Render

4 messages · Page 1 of 1 (latest)

opaque vessel
#

Tried deploying on render but all i get is 502.

# Dockerfile
FROM node:22.17.0-slim AS base

FROM base AS deps

WORKDIR /app

COPY package.json pnpm-lock.yaml ./
RUN corepack enable pnpm && pnpm install --frozen-lockfile

RUN \
  if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
  elif [ -f package-lock.json ]; then npm ci; \
  elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
  else echo "Lockfile not found." && exit 1; \
  fi
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

RUN \
  if [ -f yarn.lock ]; then yarn run build; \
  elif [ -f package-lock.json ]; then npm run build; \
  elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
  else echo "Lockfile not found." && exit 1; \
  fi

FROM base AS runner
WORKDIR /app

ENV NODE_ENV=production

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

RUN mkdir .next
RUN chown nextjs:nodejs .next
RUN chown -R nextjs:nodejs /app

COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

EXPOSE 3000

CMD ["node", "server.js"]

this Dockerfile builds into image that works on me locally, but on initial deploy, i got errors on it not being able to connect to mongodb, after making my mongodb public, the error disappeared.

grand elbowBOT
opaque vessel
#
▲ Next.js 16.2.2
- Local:         http://some-url:3000
- Network:       http://some-url:3000
✓ Ready in 0ms
==> Your service is live :tada:
==> 
==> ///////////////////////////////////////////////////////////
==> 
==> Available at your primary URL https://project-name.onrender.com
==> 
==> ///////////////////////////////////////////////////////////
[15:03:40] WARN: No email adapter provided. Email will be written to console. More info at https://payloadcms.com/docs/email/overview.
==> Detected a new open port HTTP:3000
==> Detected a new open port HTTP:3000
==> Detected a new open port HTTP:3000
==> Detected a new open port HTTP:3000
==> Detected a new open port HTTP:3000
==> Detected service running on port 3000
==> Docs on specifying a port: https://render.com/docs/web-services#port-binding
▲ Next.js 16.2.2
- Local:         http://some-url:3000
- Network:       http://some-url:3000
✓ Ready in 0ms
▲ Next.js 16.2.2
- Local:         http://some-url:3000
- Network:       http://some-url:3000
✓ Ready in 0ms

here is what shows up on logs

#

nothing more