R
Railway11mo 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
Percy11mo ago
Project ID: N/A
Gonza
GonzaOP11mo ago
No description
Fragly
Fragly11mo ago
why are you proxying your requests?
Gonza
GonzaOP11mo ago
becouse i have multiple apps that render after certains conditions
Brody
Brody11mo ago
well one of those errors has a completely different hostname, is that normal?
Gonza
GonzaOP11mo ago
its another app
Brody
Brody11mo ago
okay cool
Gonza
GonzaOP11mo ago
all works well on refresh 2 or 3 times throw error
Brody
Brody11mo ago
how are you deploying this? nixpacks? dockerfile?
Gonza
GonzaOP11mo 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
Brody11mo ago
thought so, one sec
Gonza
GonzaOP11mo ago
ENV is for remember me to add vars on railway
Gonza
GonzaOP11mo ago
if i change to slim solves that?
Brody
Brody11mo ago
well yes, but you can just add that service variable and it will also solve it
Gonza
GonzaOP11mo 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
Brody11mo ago
if you're on slim you won't need that alpine variable that's only when you use an alpine image
Want results from more Discord servers?
Add your server