Old project stopped working after re-deploying
rahat3062
FREEOP

2 years ago

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!

requests.js:17 
 GET http://localhost:5000/v1/launches net::ERR_BLOCKED_BY_CLIENT
requests.js:10 
 GET http://localhost:5000/v1/planets net::ERR_BLOCKED_BY_CLIENT

my request .js part which deciding the url:

const API_URL =
  process.env.REACT_APP_ENV === "prod"
    ? "https://the-nasa-project-production.up.railway.app/v1"
    : `http://localhost:${process.env.REACT_APP_SERVER_PORT}/v1`;

so in prod is should get the url https://the-nasa-project-production.up.railway.app/v1 not the localhost 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:

67 Replies

rahat3062
FREEOP

2 years ago

bc1834fc-5106-4839-bf78-b34a80a5af88


2 years ago

How old are we talking?


rahat3062
FREEOP

2 years ago

well according to deployment logs it is 6 months


rahat3062
FREEOP

2 years ago

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!


rahat3062
FREEOP

2 years ago

by no change i meant no change was made to the lastly deployed codebase


2 years ago

do you build it with nixpacks or a dockerfile?


rahat3062
FREEOP

2 years ago

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!


rahat3062
FREEOP

2 years ago

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


2 years ago

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


2 years ago

does it need node 14? because nixpacks will not build with node 14 (unless you pin to an old version of nixpacks)


rahat3062
FREEOP

2 years ago

so may be thats a node platform issue that deploying the code wth a non node version?


rahat3062
FREEOP

2 years ago

guys it suddenlt started working now ! XD


2 years ago

can you console.log an environment variable just for sure like Adam asked, and in the mean also send your latest build logs -


rahat3062
FREEOP

2 years ago

that means maybe it was some platform issues


2 years ago

nothing is reported, so please let's not jump to such conclusions


rahat3062
FREEOP

2 years ago

1228018101874983000


rahat3062
FREEOP

2 years ago

earlier this was showing empty


2 years ago

I'd still be very interested in seeing your build logs, would you mind sending them anyway?


rahat3062
FREEOP

2 years ago

how to download the logs


2 years ago

use this bookmarklet


rahat3062
FREEOP

2 years ago


2 years ago

please use the bookmarklet


rahat3062
FREEOP

2 years ago

is it a button?


2 years ago

follow the 3 steps on that bookmarklets page


rahat3062
FREEOP

2 years ago

can u give the url of the page?


2 years ago

right here


rahat3062
FREEOP

2 years ago


rahat3062
FREEOP

2 years ago

used the booklet script'


2 years ago

that is the deployment logs for your API, I would like the build logs for your frontend


rahat3062
FREEOP

2 years ago

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


2 years ago

okay I see


2 years ago

can I still get those build logs?


rahat3062
FREEOP

2 years ago

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!


rahat3062
FREEOP

2 years ago

terminal logs of the front build?


2 years ago

please send your build logs the same way you sent the deployment logs


rahat3062
FREEOP

2 years ago


rahat3062
FREEOP

2 years ago

instead of some docker logs there is nothing but still as you wanted here it is!


2 years ago

that's exactly what I wanted


2 years ago

well there's your reason for the missing environment variables, you aren't having railway build the frontend!


rahat3062
FREEOP

2 years ago

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!


2 years ago

I promise you, this will break again in the future if you don't set this up properly


rahat3062
FREEOP

2 years ago

so according to you env varibales are a build time thing comapred to a runtime thing?


2 years ago

for static websites, yes


rahat3062
FREEOP

2 years ago

hmmm! your comment makes sense in a way! then question comes that how it was getting the env earlier and now


rahat3062
FREEOP

2 years ago

who supplied it?


rahat3062
FREEOP

2 years ago

if it is not a runtime stuff?


2 years ago

you, probably a local .env file


rahat3062
FREEOP

2 years ago

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


2 years ago

i didnt expect there to be a .env file in your repo, i never said that


rahat3062
FREEOP

2 years ago

REACTAPPENV=dev
REACTAPPSERVERPORT=5000 REACTAPP_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?


2 years ago

you built the frontend locally!


rahat3062
FREEOP

2 years ago

yeah but my frontend repo soesnt have any env reference ! so during build time how will it get it?


2 years ago

yes it does, bruh


rahat3062
FREEOP

2 years ago

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!


rahat3062
FREEOP

2 years ago

so your claim seems to be a great magic to me!


rahat3062
FREEOP

2 years ago

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


2 years ago

i know you wrote this code a long time ago, but still, your frontend does use environment variables


rahat3062
FREEOP

2 years ago

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


rahat3062
FREEOP

2 years ago

do you want to test?


2 years ago

of course it will stop working, you arent having railway built the frontend


rahat3062
FREEOP

2 years ago

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


2 years ago

we are going in circles here


rahat3062
FREEOP

2 years ago

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?


2 years ago

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


rahat3062
FREEOP

2 years ago

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!"

1228031846147817500


2 years ago

you have significantly misunderstood almost everything i have said


rahat3062
FREEOP

2 years ago

anyways thanks for your patience! 🙂


Loading...