Vite + Docker Deployment is Successful But Application Fail To Respond Error - Help with Deployment
Project ID: 2942e240-e493-4fc3-8ec1-d06a31b5444c
I have attempted to deploy a vite app using nginx via docker but for some reason everytime it deploys it keeps saying "Application failed to respond" error. I have tried a few of the issues that are related to the similar but no solution worked so far.
I think I may be doing something wrong on my end.
I have replicated the steps locally and the image builds. When tested the app responds in the container but once deployed, I believe nginx seems to stall on railway. The app is using react-router-dom not sure if this would be an issue but stating it for additional content
Any insight in what I may be doing wrong could help:
54 Replies
Project ID:
2942e240-e493-4fc3-8ec1-d06a31b5444c
i have a ready-made solution to deploy vite apps if youd be intrested in going back to nixpacks?
@mjavacam little tag for visibility
Hey sure no prob
Sorry about the late response
haha just about to grab dinner, will get back to you after!
Alright no prob man lol food is life as we say here
delete or rename your dockerfile
https://github.com/brody192/vite-react-template
copy the nixpacks.toml and Caddyfile from this repo into yours
make sure you dont have any build or start commands set in our service settings, a procfile, railway.json, etc
Ok will do
let me know if you run into any problems!
No prob sorting it out now
hey I managed to copy the files over but it is failing on the install I am guess it is due to it being a yarn workspace or yarn monorepo?
build logs please https://bookmarklets.up.railway.app/log-downloader/
Here it is
can you share your repo?
Yes no prob
https://github.com/javaniecampbell/b2c-dashboard
It's a private repo so I invited you to it
3 years ago? is this the correct repo?
https://github.com/javaniecampbell/b2c-dashboard/tree/feature/migrate-from-cra-to-vite
Forgot to say the branch is migrate from cra to vite
yeah that makes more sense, sorry I'm very new to github
No issue that is on me no prob
how many apps does this repo contain?
3 apps
- api
- client a.k.a frontend react app
- bot
Got the api to deploy fine given that I set root folder to be api in settings for api service
how many services do you have in your railway project right now
3 main ones + a test one based on nginx template to see if i did something wrong
so let's say 2 services + mongo db
I removed the one I was testing based on nginx template
okay so if you have 3 apps in that repo, you need 3 railway services to accommodate each app in your repo (not including the database)
The bot is deployed on azure
ah okay perfect
We can skip that one
you have set the root directory of the frontend service to /client right?
Yes I have
And build watch path
and the build error is still the same?
Yup
might be a silly question, but you have set the service to deploy from the banch you linked me right?
Yes I did
Not a silly question at all
Solution
put this into your client folder, overwriting the previous file
I added it and pushed it waiting for it finish building
It has built
I see that it is using npm instead of yarn could that be an issue since it is a yarn workspace? could that be changed?
I mean the dependencies should be installed all the same, I wouldn't worry too much about that
Alright no prob
Freelance Escrow | Loading...
Web site created using create-react-app
Success
awesome!!
What pointed to that issue so I can know what to look out for in the future?
the build issue?
yes, what point you to kmow it was dependency issue that was causing the build to fail
because the build logs told me that's what it was 🙂
Oh ok I'll have to read through the logs again then no issue
Thanks man
happy to help!
I am new to railway just hope the docs can cover these issues alot of hidden gems in this helps ection here
You the man Brody!!
I wish the docs could too, but I really have no idea how to put my help into a document
I get you man, I have that issue too but let's see what I can do with mine ... I will try to put it together and share it with you.
cool, I'd love to see that when you're done