React 404 page
I have a react/django project, locally it runs fine with serve, when deploying it on firebase it worked, now on railway it deploys without an error, but i get a 404 page whatever url/path i try. I use a dockerfile and i have modified my package.json with a guide you posted for common issues when deploying react apps.
95 Replies
Project ID:
12561993-57a7-47ee-a585-f6bb61a5f346
12561993-57a7-47ee-a585-f6bb61a5f346
react frontend, django backend, in a monorepo?
yes
but we have 2 braches for deployments
one for django
one for react
2482d13c-5d1b-4e11-ada9-297b738fa18a
service id for the react deploy
branches? do you mean services?
both?
we have 2 services
64b69db4-62d6-4f9c-9cf7-724a3d8cec5c
here the django service
(i dont work for railway, these ids dont help me with anything)
srry
mb
so instead, can i see a screenshot of your project
yeah sure
dont you prefer the github repo?
id actually like both a screenshot and the repo if you dont mind?
sure
GitHub
GitHub - tomasguell/FATG2-2023-VILLADA: Proyecto Final, en busqueda...
Proyecto Final, en busqueda de desarrollar un sistema necesitado por una ong, que no tenga los recursos para afordarlo. - GitHub - tomasguell/FATG2-2023-VILLADA: Proyecto Final, en busqueda de desa...
screenshot please?
give me a moment
ok
srry for the long wait
login
sorry i should have been more clear, i wanted a screenshot of the railway project
oh
that makes more sense
lol
haha yeah mb
the two with green checks are the back and fronty
have you set root directories on the backend and frontend services?
in the dockerfiles, yes
in railway idk where they are
ok
found
nope
just a single slash as root folder
can you send me the build table at the top of the build logs for front and backend services?
front
back
you have non standard dockerfile names, how have you told railway to use them?
both of them have this with the proper path to their own dockerfile
did you say your backend service was working fine?
yes
wanna login? XD
okay cool, but i just want to note that you are running the backend in development mode with runserver, please look into using gunicorn going forward
as for the frontend, you have issues with peer deps right?
i am using gunicorn
yes
was only going off this https://github.com/tomasguell/FATG2-2023-VILLADA/blob/main/ElectroStock/dockerfile-backend#L15
ow
i se
haha that wouldnt cause issues with 404, just wanted to make sure thats why you where using --force
aahaha
ok
where are you setting the serve start command for the frontend?
package.json
am i looking at the wrong github branch?
ohhh
yes
what branch should i be looking at
remember that i said i we had 2 braches for deployments?
this is what i meant
right, but what one should i be looking at? you sent me to the main branch again
bruh
mb again
PythonMainDeploy and ReactMainDeploy
GitHub
GitHub - tomasguell/FATG2-2023-VILLADA at PythonMainDeploy
Proyecto Final, en busqueda de desarrollar un sistema necesitado por una ong, que no tenga los recursos para afordarlo. - GitHub - tomasguell/FATG2-2023-VILLADA at PythonMainDeploy
GitHub
GitHub - tomasguell/FATG2-2023-VILLADA at ReactMainDeploy
Proyecto Final, en busqueda de desarrollar un sistema necesitado por una ong, que no tenga los recursos para afordarlo. - GitHub - tomasguell/FATG2-2023-VILLADA at ReactMainDeploy
oh this is certainly an odd way of doing this
yes
its a mess
haha your words not mine
looking into it though
dont look at the commit tags
chill
do you use the dockerfile locally too?
yup
mind if i do a little re-write? (on the dockerfile)
nah
on it 🫡
take all the time you need
any idea why id be getting this error?
Not really
moving
simple-zustand-devtools
from devDependencies
to dependencies
removed this errorOk
Dude
You still on this?
Im feeling bad for you
yeah, railway went down for a bit during this
Dockerfile
with a capital D
so that railway will auto detect itNo way
Dude
Luv u
(the lowercase d was not the issue)
NOOO???
Really?
no it wasnt, you wernt running
npm run build
but simply sticking that command in your dockerfile wasnt good enough for me
this multistage dockerfile generates a ~45mb image and uses caddy, caddy uses far less memory then serve and is far more configurable
you'll need to do this, or sort out a proper solutionim prob sticking to your solution
fair enough
i regret to inform you that the Caddyfile / Dockerfile combo i gave you didnt work, it did at one point, i am fixing this
ok
im gettin this error even followin your solution
idk if its the same error that youre going thru rn
i also regened the lock file, sorry should have mentioned that
im getting 404 with caddy lol
lol
your frontend sure takes a long time to build
yeah, i get it
i will send a ticket to the frontend dev team
lol
fingers crossed, i think i have it this time, i forgot how COPY works 🤣
dsb g jkvs
omfg
it actually works
haha yep
youre my savior
right now mem is sitting at 20mb!
forgot to thank u 4 that
is really impresive
i just know the most basic things of docker and sht
and u litterally do wonders
i forgot how COPY works, im not all that good myself
do u think i know how copy works?
fair enough
this dockerfile has less layers, and i promise it still works