Len-goo-uh
Len-goo-uh
RRailway
Created by Len-goo-uh on 3/13/2024 in #✋|help
Application Failed To Respond 503 Error
Turns out it was an issue with the front end. It was pointing to a recently expired domain, after removing it and redeploying the front end code everything started working again. Turned out to be a simple fix thankfully. Thanks for all your help
36 replies
RRailway
Created by Len-goo-uh on 3/13/2024 in #✋|help
Application Failed To Respond 503 Error
nvm, fixed it!
36 replies
RRailway
Created by Len-goo-uh on 3/13/2024 in #✋|help
Application Failed To Respond 503 Error
const app = express();
const RedisStore = connectRedis(session);
const redisClient = createClient({
url: REDIS_HOST_URI,
legacyMode: true, // https://github.com/tj/connect-redis/issues/336
});

redisClient
.connect()
.then(() => console.log('Connect to Redis'))
.catch((error) => console.log(error));

mongoose
.connect(MONGODB_URI)
.then(() => console.log('Connect to mongoDB'))
.catch((error) => console.log(error));

app.use(helmet());
app.use(cors({ origin: '*' }));
app.use(express.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cookieParser());

app.use(
session({
name: 'sessionId',
store: new RedisStore({ client: redisClient }),
secret: EXPESS_SESSION_SECRET,
resave: false,
saveUninitialized: false,
cookie: {
maxAge: 3600000 * 24 * 7, // 7 days
httpOnly: true,
},
}),
);

app.use(passport.initialize());
app.use(passport.session());

passport.use(googleStrategy);
passport.use(githubStrategy);
passport.use(facebookStrategy);

app.use(requestLogger);
app.use(rootRouter);
app.use(errorLogger);

app.use(errors());
app.use(errorHandler);

// @ts-expect-error
app.listen(PORT, '0.0.0.0', () => console.log(`Start on port: ${PORT}`));
const app = express();
const RedisStore = connectRedis(session);
const redisClient = createClient({
url: REDIS_HOST_URI,
legacyMode: true, // https://github.com/tj/connect-redis/issues/336
});

redisClient
.connect()
.then(() => console.log('Connect to Redis'))
.catch((error) => console.log(error));

mongoose
.connect(MONGODB_URI)
.then(() => console.log('Connect to mongoDB'))
.catch((error) => console.log(error));

app.use(helmet());
app.use(cors({ origin: '*' }));
app.use(express.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cookieParser());

app.use(
session({
name: 'sessionId',
store: new RedisStore({ client: redisClient }),
secret: EXPESS_SESSION_SECRET,
resave: false,
saveUninitialized: false,
cookie: {
maxAge: 3600000 * 24 * 7, // 7 days
httpOnly: true,
},
}),
);

app.use(passport.initialize());
app.use(passport.session());

passport.use(googleStrategy);
passport.use(githubStrategy);
passport.use(facebookStrategy);

app.use(requestLogger);
app.use(rootRouter);
app.use(errorLogger);

app.use(errors());
app.use(errorHandler);

// @ts-expect-error
app.listen(PORT, '0.0.0.0', () => console.log(`Start on port: ${PORT}`));
36 replies
RRailway
Created by Len-goo-uh on 3/13/2024 in #✋|help
Application Failed To Respond 503 Error
Sure, it looks like most of the variables i showed you aren't used in the project itself. Here is my config.ts file showing some of the key ENV vars declared. I can also show my server.ts file if you want too. export const PORT = process.env.PORT ?? 3000; export const NODE_ENV = process.env.NODE_ENV as string; export const DOMAIN_SERVER = ${NODE_ENV === 'production' ? ${process.env.DOMAIN_SERVER as string} : 'http://localhost:3000'}; export const DOMAIN_CLIENT = ${NODE_ENV === 'production' ? ${process.env.DOMAIN_CLIENT as string} : 'http://localhost:3001'}; export const MONGODB_URI = process.env.MONGODB_URI as string; export const REDIS_HOST_URI = process.env.REDIS_HOST_URI as string; export const EXPESS_SESSION_SECRET = process.env.EXPESS_SESSION_SECRET as string; export const JWT_SECRET = process.env.EXPESS_SESSION_SECRET as string; export const OAUTH_CALLBACK_URL = ${NODE_ENV === 'production' ? ${process.env.DOMAIN_SERVER as string} : 'http://localhost:3000'}; export const PATH_LOG_ERROR_FILE = process.env.PATH_LOG_ERROR_FILE ?? 'request.log'; export const PATH_LOG_REQUEST_FILE = process.env.PATH_LOG_REQUEST_FILE ?? 'error.log'; export const FB_PIXEL_ID = process.env.FB_PIXEL_ID as string; export const FB_CONVERSIONS_API_ACCESS_TOKEN = process.env.FB_CONVERSIONS_API_ACCESS_TOKEN as string; export const GRAPH_API_VERSION = process.env.GRAPH_API_VERSION as string;
36 replies
RRailway
Created by Len-goo-uh on 3/13/2024 in #✋|help
Application Failed To Respond 503 Error
wdym? Like this? Here is a portion of the ENV, this is how some things are declared, everything else is sensitive information. MONGOHOST=${{prod-MongoDB.MONGOHOST}} MONGOPASSWORD=${{prod-MongoDB.MONGOPASSWORD}} MONGOPORT=${{prod-MongoDB.MONGOPORT}} MONGOUSER=${{prod-MongoDB.MONGOUSER}} MONGO_URL=${{prod-MongoDB.MONGO_URL}} NODE_ENV=${{shared.NODE_ENV}} NODE_OPTIONS=${{shared.NODE_OPTIONS}} PATH_LOG_ERROR_FILE=request.log PATH_LOG_REQUEST_FILE=request.log REDISHOST=${{prod-Redis.REDISHOST}} REDISPASSWORD=${{prod-Redis.REDISPASSWORD}} REDISPORT=${{prod-Redis.REDISPORT}} REDISUSER=${{prod-Redis.REDISUSER}} REDIS_HOST_URI=${{prod-Redis.REDIS_URL}} REDIS_URL=${{prod-Redis.REDIS_URL}}
36 replies
RRailway
Created by Len-goo-uh on 3/13/2024 in #✋|help
Application Failed To Respond 503 Error
No description
36 replies
RRailway
Created by Len-goo-uh on 3/13/2024 in #✋|help
Application Failed To Respond 503 Error
Yes, I'm using reference variables. It looks like none of my shared variables are being used except for NODE_ENV and NODE_OPTIONS
36 replies
RRailway
Created by Len-goo-uh on 3/13/2024 in #✋|help
Application Failed To Respond 503 Error
I'm at a loss here. Like i said earlier, everything was migrated over just fine and my project has been up and running the past few months without issue. This issue im seeing is recent. I guess i'll have to just poke around more.
36 replies
RRailway
Created by Len-goo-uh on 3/13/2024 in #✋|help
Application Failed To Respond 503 Error
port 5705? Is that the port im supposed to running on? Right now I'm seeing my project on port 26152.
36 replies
RRailway
Created by Len-goo-uh on 3/13/2024 in #✋|help
Application Failed To Respond 503 Error
yeah, it looks like it. I just looked at my projects' shared variables in the settings and I'm seeing old data there.
36 replies
RRailway
Created by Len-goo-uh on 3/13/2024 in #✋|help
Application Failed To Respond 503 Error
I made sure to note down my old database variables and there doesn't seem to be any of those referenced anywhere in the project to my knowledge. Because last week the project was up just fine, i found out today that it was down so something happened.
36 replies
RRailway
Created by Len-goo-uh on 3/13/2024 in #✋|help
Application Failed To Respond 503 Error
In my project I make sure not to hardcode anything, instead using ENV variables. I'm looking at my server and mongodb and I'm seeing all the new connection details in there.
36 replies
RRailway
Created by Len-goo-uh on 3/13/2024 in #✋|help
Application Failed To Respond 503 Error
oh, wait. should i re-deploy the mongo database? I only re-deployed my server code. It's been 3 months since the mongo database had a deployment, maybe that is it?
36 replies
RRailway
Created by Len-goo-uh on 3/13/2024 in #✋|help
Application Failed To Respond 503 Error
oh that's strange, I thought that had already been updated. I had it automatically done a few months ago when i got the warning about the databases. What connection details should I be looking at? It looks like the mongo details are all up-to-date.
36 replies
RRailway
Created by Len-goo-uh on 3/13/2024 in #✋|help
Application Failed To Respond 503 Error
Yeah, so I updated my server to follow the host and port example for node/express and merged it into may main branch and all I see in the deploy logs is: Start on port: 5705 Error: connect ECONNREFUSED 34.82.27.207:5876 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) { errno: -111, code: 'ECONNREFUSED', syscall: 'connect', address: '34.82.27.207', port: 5876 } Connect to mongoDB I'm still seeing the "Application failed to respond" page when going to my site. And the inspector still shows the 503 error. I tried re-deploying and it and no luck with that either.
36 replies
RRailway
Created by Len-goo-uh on 3/13/2024 in #✋|help
Application Failed To Respond 503 Error
re-deploying didn't seem to help
36 replies
RRailway
Created by Len-goo-uh on 3/13/2024 in #✋|help
Application Failed To Respond 503 Error
re-deploying the server? I can try
36 replies
RRailway
Created by Len-goo-uh on 3/13/2024 in #✋|help
Application Failed To Respond 503 Error
2caabd5e-e8d7-43a1-97ab-7d6d49a4d1f6
36 replies
RRailway
Created by Len-goo-uh on 6/3/2023 in #✋|help
Change MongoDB default database name
thank you, I'll let you know if I have more questions
14 replies
RRailway
Created by Len-goo-uh on 6/3/2023 in #✋|help
Change MongoDB default database name
Do you have any examples for how to do the mongodump test and mongorestore? I'm not too sure how I would be able to interact and run these commands with the database in railway
14 replies