#Application failed to respond

52 messages · Page 1 of 1 (latest)

runic basalt
#

My project deployed successfully, but it throws an error in the browser.

#

d9a138f0-83d2-4162-8ed9-905775d3273a

worthy minnowBOT
runic basalt
worthy minnowBOT
runic basalt
worthy minnowBOT
#

New reply sent from Help Station thread:

On that same page, click "view logs" it will open a tab with "details", "build logs", "deploy logs" and "https logs", can you show me all of those?

You're seeing this because this thread has been automatically linked to the Help Station thread.

runic basalt
#

These are the deploy logs, i'm not mentioning localhost anywhere in the dockerfile:

FROM node:18

WORKDIR /app

COPY package.json package-lock.json ./

RUN npm install

RUN npm install -g serve

COPY . .

ENV NODE_ENV=production

EXPOSE ${PORT:-5173}

CMD if [ "$NODE_ENV" = "development" ]; then
npm run dev -- --host 0.0.0.0 --port ${PORT:-5173};
else
npm run build && serve -s dist -l ${PORT:-5173} -L;
fi

#

Also I just migrated from Vercel and it used to work on there, so unsure what causes the issue here.

fossil fog
runic basalt
#

Thanks, I'll check it out

worthy minnowBOT
#

New reply sent from Help Station thread:

On your service, under settings, on Networking can you check your using the right port?

You're seeing this because this thread has been automatically linked to the Help Station thread.

hasty pilot
runic basalt
#

Yep, I had changed the port to vite's default instead of railway, thanks!

worthy minnowBOT
fossil fog
#

Please don't run a development server, that's going to be costly and unstable.

runic basalt
#

It's for production dw

fossil fog
#

If you have Vite handling the traffic, it is not for production.

runic basalt
fossil fog
#

If you are using vite anywhere but locally, something is being done wrong.

The community can help you here, but it might be as simple as switching to Railpack.

stone birch
#

And as Brody said, you can try using Railpack (Railways own builder) for that

#

As a starting point, you can try removing the Dockerfile, that way Railpack will be used to build your frontend.

runic basalt
#

Is there a way to just disable docker in prod but keep it in dev?

#

ah nvm I can just gitignore the dockerfile

stone birch
runic basalt
#

I see, but I don't know what to change for that, new to docker and vite, right now I've gitignored the dockerfiles

This is my vite config
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'path'

export default defineConfig({
plugins: [
vue(),
],
server: {
proxy: {
'/api': {
target: 'http://localhost:5000', // Backend server URL
changeOrigin: true, // Needed for virtual hosted sites
rewrite: (path) => path.replace(/^/api/, ''), // Rewrites the path to remove '/api'
},
},
host: '0.0.0.0', // Docker access
port: 5173,
watch: {
usePolling: true,
},
optimizeDeps: {
include: ['lucide-vue-next', 'firebase/auth', 'firebaseui'],
},
},
});

stone birch
#

Let's start by removing the Dockerfile and seeing if Railpack successfully builds it

runic basalt
#

Okay, will test that

runic basalt
#

frontend deployed using railpack, backend tried to deploy but crashed:

stone birch
#

Let's start with your frontend first

#

Keep the backend on a Dockerfile for now

runic basalt
#

Okay, anything else I need to change?

stone birch
#

Did it deploy fine? is everything working as it should?

runic basalt
#

Will see

#

it works now

stone birch
#

Cool! now we can talk about your backend, how are you deploying it? Mind sharing the Dockerfile?

runic basalt
#

Sure

#

FROM node:18-alpine

WORKDIR /app

COPY package*.json ./
RUN npm ci

COPY . .

ENV NODE_ENV=production
ENV PORT=8080
EXPOSE 8080

CMD if [ "$NODE_ENV" = "development" ]; then
npm install -g nodemon && nodemon server.js;
else
node server.js;
fi

stone birch
#

You are running nodemon, which is also only used for development purposes

runic basalt
#

yeah but thats if the env mode is development, which should be prod on railway

stone birch
#

oh ok.

runic basalt
#

not sure if this works for railway tho, but I believe it did on vercel

stone birch
#

does it show any nodemon related log in the logs?

#

Something like [nodemon] starting sucrase-node index.js or any other log that mentions nodemon at all? otherwise seems like you're prod ready!

runic basalt
#

it indeed doesn't mention nodemon anywhere

#

Thanks for your help!

stone birch
#

Then ur good to go salute

stone birch
#

!s