R
Railway5mo ago
Gonza

Custom Nodejs proxy error every 2-3 requests

I create a custom nodejs proxy to handle private applications. But every 2 or 3 request returns me and error
17 Replies
Percy
Percy5mo ago
Project ID: N/A
Gonza
Gonza5mo ago
No description
Fragly
Fragly5mo ago
why are you proxying your requests?
Gonza
Gonza5mo ago
becouse i have multiple apps that render after certains conditions
Brody
Brody5mo ago
well one of those errors has a completely different hostname, is that normal?
Gonza
Gonza5mo ago
its another app
Brody
Brody5mo ago
okay cool
Gonza
Gonza5mo ago
all works well on refresh 2 or 3 times throw error
Brody
Brody5mo ago
how are you deploying this? nixpacks? dockerfile?
Gonza
Gonza5mo ago
dockerfile
FROM node:alpine AS base


FROM base as builder
WORKDIR /app
COPY . .
RUN npm install --omit=dev
RUN npm run build

FROM base as runner
WORKDIR /app
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 myuser
USER myuser

COPY --from=builder --chown=myuser:nodejs /app/dist ./dist
COPY --from=builder --chown=myuser:nodejs /app/node_modules ./node_modules

ENV NODE_ENV production
ENV NET_ENV railway
ENV PORT 3000
ENV DOMAIN ""
ENV ENABLE_ALPINE_PRIVATE_NETWORKING true

CMD [ "node", "dist/index.js" ]
FROM node:alpine AS base


FROM base as builder
WORKDIR /app
COPY . .
RUN npm install --omit=dev
RUN npm run build

FROM base as runner
WORKDIR /app
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 myuser
USER myuser

COPY --from=builder --chown=myuser:nodejs /app/dist ./dist
COPY --from=builder --chown=myuser:nodejs /app/node_modules ./node_modules

ENV NODE_ENV production
ENV NET_ENV railway
ENV PORT 3000
ENV DOMAIN ""
ENV ENABLE_ALPINE_PRIVATE_NETWORKING true

CMD [ "node", "dist/index.js" ]
Brody
Brody5mo ago
thought so, one sec
Gonza
Gonza5mo ago
ENV is for remember me to add vars on railway
Gonza
Gonza5mo ago
if i change to slim solves that?
Brody
Brody5mo ago
well yes, but you can just add that service variable and it will also solve it
Gonza
Gonza5mo ago
ohh i understand that for private net projects i forgot to add on proxy i cahgne to slim and add vars solved! thx
Brody
Brody5mo ago
if you're on slim you won't need that alpine variable that's only when you use an alpine image