Old project stopped working after re-deploying
I had a running project that go destroyed to to resource outage! so i just brought the hobby plan! and redeployed the project! But now it is failing !
the error i am getting errors maybe because of env variables not being recognized properly!
my request .js part which deciding the url:
so in prod is should get the url https://the-nasa-project-production.up.railway.app/v1 not the url that it is trying to sent the request to !
But looks like inspite of my env the project is not working :
But the app is working:
NASA Mission Control
NASA Mission Control Dashboard
57 Replies
Project ID:
bc1834fc-5106-4839-bf78-b34a80a5af88
bc1834fc-5106-4839-bf78-b34a80a5af88
How old are we talking?
well according to deployment logs it is 6 months
but i didn't needed that so i ran out of free resources and railway blocked it but i need that projeect to up! so i just brought the plan and click the redeployed button! no changes was made! but looks like it's having issue in recognizing env!
by no change i meant no change was made to the lastly deployed codebase
do you build it with nixpacks or a dockerfile?
its showing nixpacks! actually when i built this project node was in v14 ! so yeah pretty old project! so i am even scared to touch it because renwing it up will take me a lot effort in terms of depedncy resolving and version patchings and lot of things even could break!
and it doesnt even looks like it a problem to my code base! just the problem here is maybe the app is not recgnizing env! so i can introduce a log just to prove you that! but i don't think i need it
What part of your code checks the env variable? Nothing on Railway’s side has changed how env variables work. Add print statements to your code to debug if it’s retrieving the env variable correctly and we’ll go from there
does it need node 14? because nixpacks will not build with node 14 (unless you pin to an old version of nixpacks)
so may be thats a node platform issue that deploying the code wth a non node version?
guys it suddenlt started working now ! XD
can you console.log an environment variable just for sure like Adam asked, and in the mean also send your latest build logs -
https://bookmarklets.up.railway.app/log-downloader/
that means maybe it was some platform issues
nothing is reported, so please let's not jump to such conclusions
earlier this was showing empty
I'd still be very interested in seeing your build logs, would you mind sending them anyway?
how to download the logs
use this bookmarklet
please use the bookmarklet
is it a button?
follow the 3 steps on that bookmarklets page
can u give the url of the page?
right here
used the booklet script'
that is the deployment logs for your API, I would like the build logs for your frontend
oh there i no build logs for my frontend ! because i am including a builded react app and serving the builded react project using express
okay I see
can I still get those build logs?
so like if i needed to log i need rebuild the front and include the new front build directory ! it's a little bit manual process but yeah i was a kid that time and a youtube video showed that so i foolwed it!
terminal logs of the front build?
please send your build logs the same way you sent the deployment logs
instead of some docker logs there is nothing but still as you wanted here it is!
that's exactly what I wanted
well there's your reason for the missing environment variables, you aren't having railway build the frontend!
but earlier it was working and not it is working to! and as i said i don't need to ! because my frontend is like a js file search for a env! so in that case it becomes a part of your server project! because the frontend is nothing but a route of my backend!
I promise you, this will break again in the future if you don't set this up properly
so according to you env varibales are a build time thing comapred to a runtime thing?
for static websites, yes
hmmm! your comment makes sense in a way! then question comes that how it was getting the env earlier and now
who supplied it?
if it is not a runtime stuff?
you, probably a local .env file
https://github.com/ToxicalNoob3062/THE-NASA-PROJECT/tree/master
well i think railway is fetching my latest deployment as i can see of github! and in my are eyes i can see any .env file in my repo
GitHub
GitHub - ToxicalNoob3062/THE-NASA-PROJECT: A node js project to que...
A node js project to query about future rocket launches and start and stop launches from options! - ToxicalNoob3062/THE-NASA-PROJECT
i didnt expect there to be a .env file in your repo, i never said that
REACT_APP_ENV=dev
REACT_APP_SERVER_PORT=5000
REACT_APP_PORT=5000
PORT=5000
oh my bad but my server had a .env file in my local repo with this variabbles but these never get included in the cloud repo! so then what are you trying to say?
you built the frontend locally!
yeah but my frontend repo soesnt have any env reference ! so during build time how will it get it?
yes it does, bruh
https://github.com/ToxicalNoob3062/THE-NASA-PROJECT/tree/master/client
this is the same client repo that i am seeing now in my dev env too all the files are synced ! and i am using the build command of pakcage.json which is also doesnt giving any env as it arguements!
GitHub
THE-NASA-PROJECT/client at master · ToxicalNoob3062/THE-NASA-PROJECT
A node js project to query about future rocket launches and start and stop launches from options! - ToxicalNoob3062/THE-NASA-PROJECT
so your claim seems to be a great magic to me!
that for fisrtdeployment it was not working because it didnt get the env due to the build process ! and when i retried the build env wa sosmehow go some magic and it started working gaain
i know you wrote this code a long time ago, but still, your frontend does use environment variables
https://github.com/ToxicalNoob3062/THE-NASA-PROJECT/blob/master/client/src/hooks/requests.js#L5
see there is 2 cases ! if i really supplied the env during build then even if i remove the env from the railway app it should work the same! but i can show you now a practically demo that if i remove the react app env my deployment will stop working again
do you want to test?
of course it will stop working, you arent having railway built the frontend
what are you saying??
if the env for static website is a build thing then my app should work even after i remove the runtime variable because runtime varibales are injected to the containe rby railway isn't it
we are going in circles here
because youare not clear in what you say!
build time things: the things which are decided in built time ! so if the react env is decided in built time it will store the env variable at that moment isn;t it?
do you agree that?
ive already explained everything, im sorry to hear that you where not able to understand, i would recommend becoming familiar with the technologies you are using
you was jsut wrong in this one reply and right in all other replies! everything is clear now! you were right that react supplies in build time! and so even if i change the value of the env or even delete it it's not affecting my application!
here i just changed the env as i was saying that changing the env in railway will make my app stop working! and you replied that it will defintely stop !
that was the clash! you should have replied , "nope it will work as same as it did earlier!"
you have significantly misunderstood almost everything i have said
anyways thanks for your patience! 🙂