Application Failed To Respond 503 Error
My project all of a sudden went down and I'm met with a screen that says "Application Failed To Respond". I'm not really sure what is causing this issue since it happened in the last day or so.
Any ideas on how to fix?
Solution:Jump to solution
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
27 Replies
Project ID:
2caabd5e-e8d7-43a1-97ab-7d6d49a4d1f6
2caabd5e-e8d7-43a1-97ab-7d6d49a4d1f6
have you tried re-deploying it?
re-deploying the server? I can try
re-deploying didn't seem to help
in that case, please read this docs page https://docs.railway.app/guides/fixing-common-errors
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.
looks like your app is still trying to connect to the deleted legacy database, please switch your connection details over
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.
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?
nope, you have your database connection details hardcoded somewhere, or they are simply still set to the old databases variables
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.
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.
I don't know what to tell you here, your code is still trying to connect to the old mongo database, the new database is for sure not running on port 5705
are you using reference variables?
yeah, it looks like it. I just looked at my projects' shared variables in the settings and I'm seeing old data there.
port 5705? Is that the port im supposed to running on? Right now I'm seeing my project on port 26152.
your logs, port 5705 when connecting to mongo, that is incorrect
if your app is running on port 26152 that is also incorrect, looks like you have a lot missconfigured
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.
are you using reference variables? you should not be using project level shared variables
Yes, I'm using reference variables. It looks like none of my shared variables are being used except for NODE_ENV and NODE_OPTIONS
show me how you have setup your reference variables please
They're setup like this
okay but please show me how you have written your references
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}}
yeah that stuff looks good, let's see how you are using them in code
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;show me both the mongo and redis client code please
nvm, fixed it!
what was the issue?
Solution
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
awesome, glad it was a simple fix