R
Railway10mo ago
Chioma

RAILWAY DEPLOYMENT - AutoDeploy and any deployment isn't happening

Hi! I pushed my changes to my Github and usually Railway autodeploys. This time it did not, and I tried to do so manually, and this is also not working. It only deploys the last commit instead of my latest committ. Can someone assist please?
359 Replies
Percy
Percy10mo ago
Project ID: N/A
Chioma
ChiomaOP10mo ago
8fc2ded2-11c3-4036-a22b-7b24c3e630b0
Adam
Adam10mo ago
Please send a screenshot of your Railway service's connected repo + auto deploy branch
Chioma
ChiomaOP10mo ago
Hi Adam! Okay it is an angular app so i have a frontend service and backend service...which one would you like to see?
Adam
Adam10mo ago
Whichever one's failing to deploy
Chioma
ChiomaOP10mo ago
No description
Chioma
ChiomaOP10mo ago
it is not so much failing is that it's not deploying my latest committ. the deployment it currently ran was a commit from awhile ago
Adam
Adam10mo ago
Please send a screenshot of your service's source repo and branch like the screenshot below
Adam
Adam10mo ago
No description
Chioma
ChiomaOP10mo ago
No description
Adam
Adam10mo ago
Which branch are you deploying to? If the answer is main/master, try removing the source repo and readding it
Brody
Brody10mo ago
they don't have a branch connected in their screenshot
Chioma
ChiomaOP10mo ago
when i disconnect and reconnect the deploy fails
No description
Brody
Brody10mo ago
logs please
Brody
Brody10mo ago
screenshot of your repo please
Chioma
ChiomaOP10mo ago
GitHub
AngularApp/backend at main · ChiomaGrace/AngularApp
Contribute to ChiomaGrace/AngularApp development by creating an account on GitHub.
Brody
Brody10mo ago
delete the node_modules folder
Chioma
ChiomaOP10mo ago
deleted it and failed again
Brody
Brody10mo ago
you still have the node_modules folder
Chioma
ChiomaOP10mo ago
delete in front and back end?
Brody
Brody10mo ago
yes you never want that folder in your repo
Chioma
ChiomaOP10mo ago
got it i remember that and thought i removed it but clearly not
Brody
Brody10mo ago
make sure it's in your .gitignore
Chioma
ChiomaOP10mo ago
it is working now but it is still an old committ and it isnt my latest commit
Brody
Brody10mo ago
push another commit
Chioma
ChiomaOP10mo ago
like just change something to push a commit?
Brody
Brody10mo ago
yeah
Chioma
ChiomaOP10mo ago
same situation not doing it
Brody
Brody10mo ago
what makes you think it's not your latest commit?
Chioma
ChiomaOP10mo ago
i deployed this app first to avoid headaches so all i had to do when i was finished was commit and push so it orginially looked like this
Chioma
ChiomaOP10mo ago
No description
Chioma
ChiomaOP10mo ago
ive built a crud app now and locally it looks like this
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
send the link?
Brody
Brody10mo ago
you also have the dist folder in your repo, another folder you never want in there, sorry I didn't notice that sooner add the contents of this https://www.toptal.com/developers/gitignore/api/node,angular as a .gitignore file in your frontend
Chioma
ChiomaOP10mo ago
GitHub
AngularApp/.gitignore at main · ChiomaGrace/AngularApp
Contribute to ChiomaGrace/AngularApp development by creating an account on GitHub.
Chioma
ChiomaOP10mo ago
or are u saying it needs to be in the frontend folder?
Brody
Brody10mo ago
add the one I gave you to the frontend
Chioma
ChiomaOP10mo ago
the contents are identical but my question for u is are u saying put it IN the frontend folder? right now my gitignore is outside both the backend and front end folder so just want to confirm
Brody
Brody10mo ago
contents aren't identical but please put the .gitignore I gave you in the frontend, your current .gitignore is fine where it us
Chioma
ChiomaOP10mo ago
added! still some issue though:/
Brody
Brody10mo ago
gotta delete that dist folder though
Chioma
ChiomaOP10mo ago
ah thank goodness. now it's up. thank u. i thought the gitignore took care of the dist and node modules but it didnt
Brody
Brody10mo ago
it only prevents them from coming back
Chioma
ChiomaOP10mo ago
my data isnt showing though..does the service need a restart?
Brody
Brody10mo ago
where are you storing your data?
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
is your backend connecting to the correct database when on railway?
Chioma
ChiomaOP10mo ago
yes!
Brody
Brody10mo ago
I have no ideas what could be going on then
Chioma
ChiomaOP10mo ago
yeah i think something funky i'll peep at it cause i opened the console and saw this error
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
just a little code issue
Chioma
ChiomaOP10mo ago
yeah i have no idea what though haha. i'll look at it tomorrow. thanks again for the help!! if u think of any ideas of where i should look for that error please feel free to tell me. id take any hints ! ha
Brody
Brody10mo ago
looks like you are calling the front-end when you should be calling the backend
Chioma
ChiomaOP10mo ago
hmm not sure if that's it cause the url has both in it when fully opened
Chioma
ChiomaOP10mo ago
No description
Chioma
ChiomaOP10mo ago
im reading stackoverflow and some people say it might be cors but still digging just atrange cause all api calls work locally
Adam
Adam10mo ago
That url looks really funky... Why is it your frontend and backend URLs stapled together?
Brody
Brody10mo ago
all the code for the http calls in your shared.service.ts file look fine with correct usage of the environment variable, so that leaves me to believe the service variable you set was incorrect, so please show us what you have for that
Chioma
ChiomaOP10mo ago
as in where i have NG_APP_BACKEND_URL declared?
Brody
Brody10mo ago
you would have that declared on the frontend service in railway, what do you have it set to?
Chioma
ChiomaOP10mo ago
i realize i didn't set it to anything. do u think that's the issue? when i searched it, it only appeared in the http calls i defined in my shared.service.ts
No description
Chioma
ChiomaOP10mo ago
when looking at a different project i did i declared it like this:
No description
Chioma
ChiomaOP10mo ago
should i replicate that?
Brody
Brody10mo ago
do you not have it declared on the railway frontend service?
Chioma
ChiomaOP10mo ago
oh! yeah i do there
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
what is it set to?
Chioma
ChiomaOP10mo ago
angular-app-backend-production.up.railway.app
No description
Brody
Brody10mo ago
show the raw editor instead please
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
set it to https://${{Angular App Backend.RAILWAY_PUBLIC_DOMAIN}}
Chioma
ChiomaOP10mo ago
howd you know to do that!? i do have another error (unrelated), but what you just sent me fixed the previous error
Brody
Brody10mo ago
I'm been using railway a very long time, it's also not the first time we have done this exact thing also, please take your mongo url out of the frontend's .env.local file, that is only to be used for non sensitive information
Chioma
ChiomaOP10mo ago
so u have to manually change the raw editor? i don't remember doing that last time. what i sent in the first screenshot of the raw editor is what was there when i created the variable, so i need to always manually change it to what u sent in the future?
Brody
Brody10mo ago
I mean you wouldn't have to change anything if you entered the correct reference variable the first time 😅 but yes that what you will need for all backend url variables in this context, of course replace the service name with the applicable service name in the future
Chioma
ChiomaOP10mo ago
but i dont get how i entered it incorrectly i guess cause i clicked generate domain initally here are the notes i took/was following
Brody
Brody10mo ago
it's wrong for two reasons 1. it's not a url, since it's missing the https:// part 2. it's not a reference variable, the variable I gave you is
Chioma
ChiomaOP10mo ago
No description
Chioma
ChiomaOP10mo ago
No description
Chioma
ChiomaOP10mo ago
okay so on my step 5 if i put http: angular-app-backend-production.up.railway.app then it would've been fine?
Brody
Brody10mo ago
it would have worked, yes. though that's called a hardcoded variable, we don't want that, we want to use a reference variable. consider this scenario for a hardcoded url like what you just suggested: you change the domain on the backend, maybe you just want to change the railway provided domain or you want to add a domain you bought, but you have hardcoded that variable on the frontend service and have forgotten to update it manually so it is no longer correct and if the domain is incorrect your app fails to call the backend, this is not ideal. now here's the scenario where you use a variable reference like I gave you: you change the domain on the backend again for whatever reason, that reference variable is automatically updated when you deploy the frontend, no intervention needed since it will always reference the backend's domain, just makes things so much easier.
Chioma
ChiomaOP10mo ago
okay i think i understand so in the future i declare the variable and then select one of these options here:
Chioma
ChiomaOP10mo ago
No description
Chioma
ChiomaOP10mo ago
is that correct? and not hardcode it
Brody
Brody10mo ago
nope please see the variable I gave you you need to specify the backend service name as it's shown in your project canvas
Chioma
ChiomaOP10mo ago
yeah but i dont understand where this came from at all. this was not an option when i clicked generate domain
Brody
Brody10mo ago
it may reference the domain, but it doesn't really have anything to do with generating a domain, it's something you need to set at your discretion
Chioma
ChiomaOP10mo ago
so this should be changed too then huh? syntax wise..my frontend url?
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
yes, remember everything I've just said and give it a shot!
Chioma
ChiomaOP10mo ago
on it
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
you're missing https:// otherwise, the reference syntax itself is correct
Chioma
ChiomaOP10mo ago
shoot! adjusted and fixed my notes so i def got it down AND that fixed the other error. i can see my data now! that actually helped me learn alot...that mistake thanks for walking me through thar
Brody
Brody10mo ago
happy to help!
Chioma
ChiomaOP10mo ago
also i think i did this because it was the only way it was saving to my database on railway, locally
Brody
Brody10mo ago
it's not, you want to use railway run but even so it doesn't belong in your frontend, since the frontend doesn't connect to mongo
Chioma
ChiomaOP10mo ago
youre right! idk why i did it then okay everything is good to go! thanks for the help gunna start learning react tomorrow and try to do aproject on there have a good night brody! thanks again:)
Brody
Brody10mo ago
no problem! 🙂
Chioma
ChiomaOP10mo ago
Hi @Brody ! Are you still on this thread?
Brody
Brody10mo ago
im here
Chioma
ChiomaOP10mo ago
Lovely! I was using your starter pack as a guide(https://github.com/brody192/create-react-app-starter) to push my react app on railway I (think) I have setup my Railway as needed, so I connected my Repo to my two service variables. This potentially might be a question for Discord Github, but when I push my changes to Github, it does not commit my frontend or backend folder. It only committed the react skeleton if that makes sense. Is this normal?
GitHub
GitHub - brody192/create-react-app-starter
Contribute to brody192/create-react-app-starter development by creating an account on GitHub.
Chioma
ChiomaOP10mo ago
GitHub
GitHub - ChiomaGrace/ReactApp
Contribute to ChiomaGrace/ReactApp development by creating an account on GitHub.
Brody
Brody10mo ago
1. your repo is not a clone of mine, it's just the bare standard app 2. it's not a monorepo like your angular apps are, the repo only contains the front-end
Chioma
ChiomaOP10mo ago
1. yes i did not clone it. as i mentioned i was using yours as a guide/referencing it 2. yes but my structure in vs code does not only contain the front-end. however it only pushed the front end to Github. This is what I found strange
Brody
Brody10mo ago
1. you'd need the Caddyfile and nixpacks.toml from my repo 2. that repo only contains the front-end, therefore pushing to it would only deploy the front-end, perfectly normal
Chioma
ChiomaOP10mo ago
this is what is in my code
Chioma
ChiomaOP10mo ago
No description
Chioma
ChiomaOP10mo ago
i have what youre saying! i am just confused why it isnt pushing to Github
Brody
Brody10mo ago
empty commit message
Chioma
ChiomaOP10mo ago
that was an old error ive deleted the remote and redone my first commit and it continues to only do the front end
Brody
Brody10mo ago
this repo is only your front-end
Chioma
ChiomaOP10mo ago
correct haha thats my question it's not pushing my backend folder this is my code setup
Brody
Brody10mo ago
it's not pushing the backend folder because that's not part of the front-ends repo your backend and frontend are in separate repos
Chioma
ChiomaOP10mo ago
ohh really? that's how you set it up for a railway deployment for react? two repos?
Brody
Brody10mo ago
you can do it either way, but that's how you have done it
Chioma
ChiomaOP10mo ago
not intentionally i set up my code like i did in vs then pushed to github and it keeps only showing my frontend so how do i include backend with the same repo
Brody
Brody10mo ago
create a new repo, copy the two folders into the repo
Chioma
ChiomaOP10mo ago
sorry dumb question..but youre saying in github right? not recreate my project in vs code?
Brody
Brody10mo ago
correct in github
Chioma
ChiomaOP10mo ago
this time i am doing by the command line instead of in vs code i got this error
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
just use github desktop
Chioma
ChiomaOP10mo ago
never used that before. hopefully i did it right got this now in github
Chioma
ChiomaOP10mo ago
GitHub
GitHub - ChiomaGrace/ReactApp
Contribute to ChiomaGrace/ReactApp development by creating an account on GitHub.
Chioma
ChiomaOP10mo ago
backend service variable deployed frontend service variable failed
Brody
Brody10mo ago
you have the frontend folder linked to something else, and the nixpacks.toml and caddyfile are in the wrong folder but thats the least of your concerns
No description
Chioma
ChiomaOP10mo ago
linked to something else?
Brody
Brody10mo ago
yeah, i dont know how it works either, but i know that it shouldnt be like that
Chioma
ChiomaOP10mo ago
okay i will delete and try again the desktop github you told me to download im not really understanding how to use
Brody
Brody10mo ago
github desktop, its far easier than git cli
Chioma
ChiomaOP10mo ago
i am so confused haha it just keeps making source repos that i now cant delete
Chioma
ChiomaOP10mo ago
No description
Chioma
ChiomaOP10mo ago
i really think i setup my railway correctly so the minute i am able to just upload my code to github i think it'll work wasnt expecting this step to be so problematic
Brody
Brody10mo ago
you are definitely gonna confuse yourself if you try to do source control in vscode. create a new repo, copy your frontend and backend folders into it, push it
Chioma
ChiomaOP10mo ago
no i didnt i used the app like u said
Brody
Brody10mo ago
the screenshot you just sent was you trying to use git in vscode
Chioma
ChiomaOP10mo ago
nope just showing u what has now occured and i cant remove it
Brody
Brody10mo ago
dont do git in vscode please create a new repo with github desktop, click the show in explorer button, copy your frontend and backend folders into it, commit the changes.
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
i dont know what that is
Chioma
ChiomaOP10mo ago
github desktop
Brody
Brody10mo ago
not what mine looks like, but close enough
Chioma
ChiomaOP10mo ago
so what am i clicking there
Brody
Brody10mo ago
plus button
Chioma
ChiomaOP10mo ago
then this correct?
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
its not going to be just the react app, so give it an applicable name
Chioma
ChiomaOP10mo ago
it is cause it's just a practice one for me so create repository yeah?
Brody
Brody10mo ago
its not going to be just the react app, so give it an applicable name
Chioma
ChiomaOP10mo ago
can i not change it later/
Brody
Brody10mo ago
its simplest if you name it correctly now
Chioma
ChiomaOP10mo ago
im fine w the name. so is it cool if we continue? or u really want me to change it that bad
Brody
Brody10mo ago
go for it, im only saying whats best
Chioma
ChiomaOP10mo ago
i get ya this happens
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
follow the steps please create a new repo with github desktop - done! click the show in explorer button copy your frontend and backend folders into it commit the changes.
Chioma
ChiomaOP10mo ago
it doesnt show any of the react files in my frontend
Chioma
ChiomaOP10mo ago
No description
Chioma
ChiomaOP10mo ago
but when i click frotend it takes me to that folder containing everything in vs code
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
not really sure what to tell you here, you just need to copy the frontend and backend folders into the folder github desktop makes, it's just drag and drop at that point
Chioma
ChiomaOP10mo ago
i did
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
then commit and publish
Chioma
ChiomaOP10mo ago
it wont let me
Brody
Brody10mo ago
why not
Chioma
ChiomaOP10mo ago
because there is nothing in the frontend as i showed
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
make sure the frontend folder contains the frontend files please
Chioma
ChiomaOP10mo ago
it's not
No description
Brody
Brody10mo ago
github desktop seems to think otherwise
Chioma
ChiomaOP10mo ago
it doesnt when i click on it
Chioma
ChiomaOP10mo ago
Hi Brody, I finally got Github Desktop to work. Sorry about that. My frontend service variable deployed on railway, but here is the error with my backend service. Would you mind terribly taking a look please?
Brody
Brody10mo ago
Error: No start command could be found
Error: No start command could be found
Chioma
ChiomaOP10mo ago
ah shoot got it. didn't hit save in that file all good now thank you !!
Brody
Brody10mo ago
no problem!
Chioma
ChiomaOP10mo ago
Hi again @Brody ! This chat still open?
maxralph01
maxralph0110mo ago
What problem are you having? I do not work for Railway. But let's see if we can help you, Chioma.
Chioma
ChiomaOP10mo ago
Okay, thanks! I am having a problem getting my railway backend service variable to work in a react app. Everytime I try to submit my post request, I get a 503 Service Unavailable Error. Here is my component with my form and .env file:
No description
Chioma
ChiomaOP10mo ago
Here is my error:
No description
Chioma
ChiomaOP10mo ago
Can you assist please?
maxralph01
maxralph0110mo ago
Yes Seems you are offline as well Let us meet here in exactly an hour. I believe we both should be available by then. Went back to work after waiting for your reply. But I will be available to work it through with you in an hour. Later then
Brody
Brody10mo ago
looks like we are all online now
maxralph01
maxralph0110mo ago
Not fully
Brody
Brody10mo ago
line 19 of that jsx file, the fetch call should use the format process.env.REACT_APP_BACKEND_URL + /path your .env file should be a .env.local file instead line #2 of your .env.local file should be REACT_APP_BACKEND_URL=http://127.0.0.1:<the port the backend runs on> as for the railway side of things, you have some misconfigurations there too, but let's get this working locally first
maxralph01
maxralph0110mo ago
I am now available
Brody
Brody10mo ago
did I miss anything?
maxralph01
maxralph0110mo ago
No. You're in order. I see her problem is more of React than hosting That was why I offered to help
Brody
Brody10mo ago
indeed, there will be some misconfigurations on the railway side of things most likely too
maxralph01
maxralph0110mo ago
Apparently At least with your help in familiarizing me with the system, I would say I have some little Railway cloud knowledge Thanks again
Brody
Brody10mo ago
happy to help where I can!
Chioma
ChiomaOP10mo ago
hi guys so sorry for the delay thank you for looking at my screenshots and trouble shooting i have made the suggested changes, but i am still getting the same error
Chioma
ChiomaOP10mo ago
No description
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
you haven't saved the .env.local file by the looks of it
Chioma
ChiomaOP10mo ago
ah i see what u mean cause the variable didnt change in the html. saved it now but still the same error
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
somewhere in code you're not using that backend url environment variable to make an api call the variable name is also incorrect, please carefully read what changes I've asked you to make
Chioma
ChiomaOP10mo ago
yup naming syntax was off. it is working now locally
Brody
Brody10mo ago
awesome, now let's see what service variables you have on the frontend service in railway
Chioma
ChiomaOP10mo ago
i am assuming i need to change this to just BACKEND_URL..is this correct?
No description
Brody
Brody10mo ago
yeah that's for angular, you need to have the applicable environment variable set in the service variables
Chioma
ChiomaOP10mo ago
adjsuted!
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
that's not the same variable you use in code
Chioma
ChiomaOP10mo ago
it is not. apologies
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
what is the raw value of that variable
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
looks good to me
Chioma
ChiomaOP10mo ago
getting a cors error that ive been trying to deal w
Brody
Brody10mo ago
refer to your notes about the express backends you've done when working with angular you would need the same environment variable and cors middleware code
Chioma
ChiomaOP10mo ago
sorry i am being unclear! i understand the error, and why cors is needed (this helped explain that to me pretty well: (https://www.stackhawk.com/blog/react-cors-guide-what-it-is-and-how-to-enable-it/) what i mean is i think i dealt with the error in the way that is needed, but i keep getting the same error.
StackHawk
React CORS Guide: What It Is and How to Enable It
A brief guide on what CORS is and how it works. See it in action and learn how to enable CORS in a React application.
Chioma
ChiomaOP10mo ago
error:
No description
Chioma
ChiomaOP10mo ago
me implementing cors on the backend in my sevrer
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
this post request is being sent to your frontend domain
Chioma
ChiomaOP10mo ago
i thought my backend railway service should have the frontendurl as a variable? like this:
No description
Chioma
ChiomaOP10mo ago
i switched it as youre suggesting, but it's returning undefined because i dont have that variable here whereas with the frontend variable i do have in my backend service
Chioma
ChiomaOP10mo ago
No description
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
what i said didnt have anything to do with the backends service variables. your frontend is making api calls to the frontend domain, it needs to make api calls to the backend domain.
Chioma
ChiomaOP10mo ago
my frontend domain has the backend url
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
as you can see by these error messages, your frontend is calling the frontend domain
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
now it's correct though now I find it odd that your locally running frontend is making requests to the backend on railway
Chioma
ChiomaOP10mo ago
after i got locally running correctly. i tried to set up production. so i have this in a .env
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
just as a sanity check can you show me your frontend making calls to your locally running backend without issues?
Chioma
ChiomaOP10mo ago
sure thing! one sec
Chioma
ChiomaOP10mo ago
No description
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
can you send the repo again please
Chioma
ChiomaOP10mo ago
GitHub
GitHub - ChiomaGrace/ReactApp
Contribute to ChiomaGrace/ReactApp development by creating an account on GitHub.
Brody
Brody10mo ago
you keep commiting your node_modules folder
Chioma
ChiomaOP10mo ago
i have them in two gitignores!! so idk why thats happening
Chioma
ChiomaOP10mo ago
GitHub
ReactApp/.gitignore at main · ChiomaGrace/ReactApp
Contribute to ChiomaGrace/ReactApp development by creating an account on GitHub.
Brody
Brody10mo ago
what happens if you just open the backend domain in your browser
Chioma
ChiomaOP10mo ago
it just spins but i can see my console logs in railway
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
please send me the domain
Chioma
ChiomaOP10mo ago
i gave you access to the project! i think it shouldve emailed ya
Brody
Brody10mo ago
please send the domain
Brody
Brody10mo ago
there would be a code issue here somewhere
Chioma
ChiomaOP10mo ago
okay. should i make another post and ask the thread? cause ive been poking around today and not too sure what it is
Brody
Brody10mo ago
yeah thats a good idea
maxralph01
maxralph0110mo ago
I think you need a mentor. You should find someone near you. If you cannot find, I can mentor you. But you must mentor my youngest sister too. She has so much potential but is not utilizing all that wonderful potential. She plays soccer just like you at the state level in Imo State where we come from. But recently, she just stopped. Someone who got to that level. She's smart enough to code too if she wanted to, but she hasn't indicated interest in coding. The coding part, she can decide not to. That is no problem. She's your age and I believe your lingo would rhyme with hers. If you can get her start getting her back on track for me, I will make you a badass coder. can start*
Chioma
ChiomaOP10mo ago
Hi Max! I think with sports, just like anything in life, the individual person has to want it, so I don't know if anything I could say could make her want it to happen if that makes sense. But if she has any questions about soccer or something, I'd be happy to answer them the best I can!
maxralph01
maxralph0110mo ago
I see. OK. I'll talk with her. Meanwhile, is your app up?
Chioma
ChiomaOP10mo ago
It's getting there! I figured out what was causing the deployment to fail on the backend folder and frontend folder. Now my question is how do I correctly setup a deployment for the react app? Do I need a caddyfile and nixpacks.toml? Right now my app works deployed when it is basic html. I find it errors when I include routing. My routing works locally, but the routing causes the deployment to fail when deployed. Is there some configuation I am missing that is needed for routing in deployment? @Brody @maxralph01
Brody
Brody10mo ago
yes you do need the nixpacks.toml and Caddyfile that ive previously linked
Chioma
ChiomaOP10mo ago
Right now my app is deployed just like this: https://testdeployment-frontend-production.up.railway.app/ The buttons in the nav do not route anywhere. The minute I configure them to route somewhere and then push the changes live, the deployment fails
React App
Web site created using create-react-app
Brody
Brody10mo ago
build logs please
Chioma
ChiomaOP10mo ago
ooo looks like i solved it! now i will try to tackle the api issue from earlier
Brody
Brody10mo ago
what solved it?
Chioma
ChiomaOP10mo ago
it didn't like that i had a stylesheet i imported on a component that i wasn't using (yet)
Brody
Brody10mo ago
interesting
Chioma
ChiomaOP10mo ago
then the backend errors where coming from my multer/cloudinary packages. locally the api request works (so when the post url is ('http://127.0.0.1:8000/submitResident') when i try to use the railway variable the api request ${process.env.REACT_APP_BACKEND_URL}/submitResident) is just pending
Chioma
ChiomaOP10mo ago
No description
Chioma
ChiomaOP10mo ago
No description
Chioma
ChiomaOP10mo ago
ive been digging around and i saw this guy use the port key as an environment variable in railway..do u think i should give that a go? https://www.youtube.com/watch?v=N9hrClMJFqk (1 min 54 sec) he seemed to have success w configuring that way
Cand Dev
YouTube
Deploy React & Node Express App Online in Minutes with Railway (No ...
In this video, you will learn how to easily deploy a React web application and a Node.js/Express server online using Railway. Build AI Image Generator With OpenAI, ReactJs and Tailwindcss - https://youtu.be/Yh2gz1sz-b8 👨‍💻Code: Frontend - https://github.com/candraKriswinarto/genieart backend - https://github.com/candraKriswinarto/genieart-api...
Brody
Brody10mo ago
you already do, at least you did last time i checked your backend code
Chioma
ChiomaOP10mo ago
oh yeah true i guess you dont need a frontend and backend service variables for react? as long as i have the port key it seems to work?
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
that video is not good, it leaves so many things out, and that causes you to leave them out
Chioma
ChiomaOP10mo ago
what did i leave out?
Brody
Brody10mo ago
from your last message, you seem to want to leave out some variables?
Chioma
ChiomaOP10mo ago
no. i am saying when i orginially set this app for deployment i followed how i did it for angular. so my frontend service had a backendurl variable and vice versa with my backend service then when i tried to use the backendurl in a .env file it wouldnt work. however when the api link was the localhost it did work so all i did was leave it as the localhost url and it still works in deployment which surprises me
Brody
Brody10mo ago
yes theres something wrong with your backend deployment
Chioma
ChiomaOP10mo ago
so it is incorrect to use the localhost url? cause it worked locally and deployed
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
just because something "works" doesnt mean its correct you need to find out why your backend on railway is just infinitely loading
Chioma
ChiomaOP10mo ago
it's not haha
Brody
Brody10mo ago
oh you've fixed it?
Chioma
ChiomaOP10mo ago
yeah it doesn't infinite load anymore. it is like this now https://react-app-backend-production.up.railway.app/
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
cool, what was the issue?
Chioma
ChiomaOP10mo ago
the issue now is the api request doesnt go through and it pends
Brody
Brody10mo ago
what was the issue with the backend
Chioma
ChiomaOP10mo ago
^
Brody
Brody10mo ago
oh that was causing it to infinity load?
Chioma
ChiomaOP10mo ago
it appears so
Brody
Brody10mo ago
okay and where can i see an issue with the frontend?
Chioma
ChiomaOP10mo ago
frontend is also deployed w no issue the problem i have now is the api request/submitting a form
Brody
Brody10mo ago
yes please send me a link to where i can see this issue happening
maxralph01
maxralph0110mo ago
Sorry for being late to the party. I was having the same issue with React on Railway. Another way is to use "yarn" for your package manager instead of "npm". I usually do not want to go through the stress of adding extra files. And when using yarn in your package manager, add this line to your list of commands in your package.json file: "start": "npx http-server ./dist" This line uses the http-server package to serve your react files. Railway on seeing that command, I noticed, installed the http-server for me and served my files And finally, For the settings on your Railway, change the build command to: "yarn build" (without the quotes of course) And the start command, make it: "yarn start" (without the quotes of course) I would also like to try this pattern sometime The routing I use currently is HashRouter (if you are using react-router). But one thing about this is that your URL looks untidy. Give it a browse. Replace BrowserRouter with HashRouter.
Chioma
ChiomaOP10mo ago
Brody
Brody10mo ago
please dont make these kinds of recommendations, i understand you're trying to help but it would only add to the complexity
maxralph01
maxralph0110mo ago
Again, if you want to use BrowserRouter on production, there is another pattern yet. I will give you a detailed guide on how I implemented it, if it works. Because I am planning on using it on my next project. Ah OK
Chioma
ChiomaOP10mo ago
i did see this being suggested in some stackoverflows
Brody
Brody10mo ago
chioma, please stick with npm and the nixpacks.toml and Caddyfile
maxralph01
maxralph0110mo ago
That is what I have been using on the quick projects I am building in React
Brody
Brody10mo ago
^ while http-server is better than a development server, it is still far from ideal in so many ways
maxralph01
maxralph0110mo ago
OK. Please, do so, @Chioma . Just know there is another way for another time. I only feel it is good to have options.
Brody
Brody10mo ago
having options is good, only when the proposed option is a good option
Chioma
ChiomaOP10mo ago
sticking with it sounds good! thanks for trying to help max:)
Brody
Brody10mo ago
agree, thank you okay back to the topic, where am i supposed to be seeing errors?
Chioma
ChiomaOP10mo ago
i made some more changes so i think you can see now. if you go to the create component and look at the console log when you try to submit something
Brody
Brody10mo ago
its working?
Chioma
ChiomaOP10mo ago
it's submitting but i hav e no idea how cause it's not going to the create function otherwise i would see my console logs in said function but it saves into the mongodb it's very strange
Brody
Brody10mo ago
just seems like a code issue?
Chioma
ChiomaOP10mo ago
it's the api link when it is a http://127.0.0.1:8000/submitResident works like a charm
Chioma
ChiomaOP10mo ago
No description
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
please do not hardcode the url
Chioma
ChiomaOP10mo ago
not my plan just trying to show u the difference one sec for when i use the railway backend service variable
Chioma
ChiomaOP10mo ago
No description
Chioma
ChiomaOP10mo ago
No description
Brody
Brody10mo ago
lets see the backend logs these are local logs
Chioma
ChiomaOP10mo ago
those are backend logs
Brody
Brody10mo ago
nope, those are you local backend logs last I checked railway does not show you a windows terminal
Chioma
ChiomaOP10mo ago
i guess i am not understanding why you want to see the railway logs when we can see the issue locally not working my angular app when i was using railway run start when i submitted a form, i could see the logs and then check on railway and see the data stored in my database what i am trying to explain here is that my react ap with the railay api i cannot see the logs of my create function
Brody
Brody10mo ago
because your frontend is making an api call to the backend that's running on railway, therefore the backend on railway would have the logs
Chioma
ChiomaOP10mo ago
okay. i thought it would show that locally one sec let me grab them
Chioma
ChiomaOP10mo ago
ah i see what u mean. my logs are there, so it IS working as i expected
Brody
Brody10mo ago
yes, you're probably just incorrectly setting the backend environment variable locally
Chioma
ChiomaOP10mo ago
how come you say that? because i should see those cosole logs in my local termina?
Brody
Brody10mo ago
because your locally running frontend should not be making a call to the backend running on railway therefore you have the variable set wrong
Chioma
ChiomaOP10mo ago
oh yeah thats def how i set it up what should my lcoal front end be making a call to then?
Brody
Brody10mo ago
in this screenshot you have a .env file in your frontend, you should not have a .env file in your frontend, it should be a .env.local file like we have talked about unless you are doing some specific testing, the locally running frontend should be making a call to the locally running backend
Chioma
ChiomaOP10mo ago
gotcha. i adjusted now
No description
Chioma
ChiomaOP10mo ago
do i do the same for .env.production now? and then put the railway url there
Brody
Brody10mo ago
in this case, production stuff stays in the railway service you should really only have one type of .env file in your frontend and that would be the .env.local file
Chioma
ChiomaOP10mo ago
you know how in angular i could run production mode locally is this not possible in react? this is what i am trying to achieve in my angular app i was using the railway domain locally for my api. i was trying to replicate this in my react app
Brody
Brody10mo ago
railway run npm run dev same thing you do for the backend
Chioma
ChiomaOP10mo ago
and still npm run start for the frontend or npm run build?
Brody
Brody10mo ago
no need to run a build locally, since you run a dev server for the frontend locally
Chioma
ChiomaOP10mo ago
right on. the lightbulb in my head finally went on i think what i was struggling with was not seeing my logs but when u said check railway and i saw them it helped clear a lot of confusion for me thanks soo much brody. always make things super clear and i leave w a better understanding. appreciate your time!!
Brody
Brody10mo ago
happy to help!
maxralph01
maxralph0110mo ago
You're welcome
Chioma
ChiomaOP8mo ago
Hi @Brody! Is this chat still open?
Brody
Brody8mo ago
we are at 445 messages, would you mind opening a new thread?
Chioma
ChiomaOP8mo ago
sure thing! https://discord.com/channels/713503345364697088/1222693316106387566 Hi @Brody I don't have a Railway related question. My question is for NodeJs. Do you know a Discord community I can go to join and ask by chance? The only one I saw/tried to join didn't allow me to post questions
Brody
Brody8mo ago
I dont sorry, is it not something you could google for?
Chioma
ChiomaOP8mo ago
Shoot okay thanks. I thought I'd try to ask ya to see. I've been trying but not having too much luck I'll keep looking!
Brody
Brody8mo ago
well you got me curious, whats the question?
Chioma
ChiomaOP8mo ago
haha you sure?
Brody
Brody8mo ago
yeah I'm just curious, it's unlikely that I'd be able to answer
Chioma
ChiomaOP8mo ago
I am attempting to implement a Google authorization on my React Native App. I've read a lot and watched a lot of videos, but this one made the most sense to me, so I attempted this method (https://www.youtube.com/watch?v=Qt3KJZ2kQk0) I am at 21 minutes in the video. For Tom in his video, when he clicked on the button to trigger his api call, the Google dialog box appeared. For me, this doesn't happen. So that's where I am stuck I do not get any errors, and I do see the same console logs at this point in the video. The only difference is the Google dialog box doesn't pop up for me. S'close!
TomDoesTech
YouTube
Google OAuth 2.0 With NodeJS (No Passport or googleapis)
Repository: https://github.com/TomDoesTech/Google-OAuth-NodeJS 📚 Concepts & technologies covered - OAuth 2 - JWT - Authentication & authorization - TypeScript - Node.js - Google OAuth 2.0 🌎 Follow me here: Discord: https://discord.gg/4ae2Esm6P7 Twitter: https://twitter.com/tomdoes_tech Facebook: https://www.facebook.com/tomdoestech​ Instagram:...
Brody
Brody8mo ago
ah okay my curiosity is satisfied, and I indeed don't have an answer for that
Chioma
ChiomaOP8mo ago
hahahaha i understand want an update if i figure it out?
Brody
Brody8mo ago
yes!
Chioma
ChiomaOP8mo ago
i figured it out🥹 but on react native web so works in a web browser now i have to do it for android and ios. it is a processs
Brody
Brody8mo ago
glad to hear that!!
rwbcodes
rwbcodes8mo ago
Can you check your DM? 😁 Sorry Brody/Chioma I was wondering if you could help me out with deploying a react native web project on railway! Thanks so much!!
Medim
Medim8mo ago
Can you please open your own thread and describe the issues you are having?
Chioma
ChiomaOP2w ago
Hi Brody! Still active here?
Adam
Adam2w ago
He can be! @Brody
Brody
Brody2w ago
👋
Want results from more Discord servers?
Add your server