rupesh2758
rupesh275814mo ago

TRPC API not working for production build

I am using Trpc and next in project, The App is fully functional with dev build , but api's giving 400 BAD Request on production build done with docker, I am doing standalone next js build I tried to debug., follow other examples but not able to figure it out any issue This is docker code
FROM node:18-alpine AS dependencies

RUN apk update && apk add --no-cache python3 make g++ git openssh postgresql-dev libc6-compat

WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn

FROM node:18-alpine AS build

ARG DATABASE_URL

ENV NEXT_TELEMETRY_DISABLED 1

WORKDIR /app
COPY --from=dependencies /app/node_modules ./node_modules
COPY . .

RUN npx prisma generate
RUN yarn build

FROM node:18-alpine AS deploy

WORKDIR /app

ENV NODE_ENV production

COPY --from=build /app/public ./public
COPY --from=build /app/package.json ./package.json
COPY --from=build /app/.next/standalone ./
COPY --from=build /app/.next/static ./.next/static
COPY --from=build /app/.next/server ./.next/server

EXPOSE 3000

ENV PORT 3000

CMD ["node", "server.js"]
FROM node:18-alpine AS dependencies

RUN apk update && apk add --no-cache python3 make g++ git openssh postgresql-dev libc6-compat

WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn

FROM node:18-alpine AS build

ARG DATABASE_URL

ENV NEXT_TELEMETRY_DISABLED 1

WORKDIR /app
COPY --from=dependencies /app/node_modules ./node_modules
COPY . .

RUN npx prisma generate
RUN yarn build

FROM node:18-alpine AS deploy

WORKDIR /app

ENV NODE_ENV production

COPY --from=build /app/public ./public
COPY --from=build /app/package.json ./package.json
COPY --from=build /app/.next/standalone ./
COPY --from=build /app/.next/static ./.next/static
COPY --from=build /app/.next/server ./.next/server

EXPOSE 3000

ENV PORT 3000

CMD ["node", "server.js"]
0 Replies
No replies yetBe the first to reply to this messageJoin