Struggling with Nixpacks build failed error

Hi, I have an app I'm trying to deploy built in python, I am able to run it locally through Flask with no issues but when I use Railway I get the 'no start command could be found' error. In my repo I have a Procfile, interface file w (html, css and js), my project file in python, a knowledge file (in docx) and a requirements.txt file. Any help would be appreciated
57 Replies
Percy
Percy11mo ago
Project ID: e1307a79-f324-4e06-b4ad-eae0f4a820a9
Percy
Percy11mo ago
Project ID: e1307a79-f324-4e06-b4ad-eae0f4a820a9
elysian-mv1
elysian-mv1OP11mo ago
e1307a79-f324-4e06-b4ad-eae0f4a820a9
maddsua
maddsua11mo ago
Mind sharing the build logs, what the error looks like? You can use this bookmarklet to download logs in one take: https://bookmarklets.up.railway.app/log-downloader/
Medim
Medim11mo ago
Do you have set a start command in the service settings?
elysian-mv1
elysian-mv1OP11mo ago
@Medim I can't seem to find a place to enter a start command in my project settings
maddsua
maddsua11mo ago
You enter start command in service settings
elysian-mv1
elysian-mv1OP11mo ago
@madhdsua
No description
Medim
Medim11mo ago
Its on the service settings, not the project Services are the block-like containers located inside your Project
maddsua
maddsua11mo ago
here
No description
elysian-mv1
elysian-mv1OP11mo ago
i've tried 'npm run start' and still getting the same error
Medim
Medim11mo ago
But its a Flask app...
maddsua
maddsua11mo ago
that's a start command for a nodejs project you'd need to use the same command you use to run it locally
elysian-mv1
elysian-mv1OP11mo ago
I run the code locally through Postman- would I find the command within my own code or on Postman ? sorry, this is a hobby project - please excuse any stupid questions haha
maddsua
maddsua11mo ago
I'd expect the command to be something like python main.py
Medim
Medim11mo ago
Postman just makes the request
elysian-mv1
elysian-mv1OP11mo ago
ok progess has been made - 'python main.py' worked
elysian-mv1
elysian-mv1OP11mo ago
No description
elysian-mv1
elysian-mv1OP11mo ago
I now have this, I've already ran the --upgrade pip ah I see the gunicorn build should have a '.' not a ':' not sure about the last error there - 'failed to solve: process...'
Adam
Adam11mo ago
the gunicorn fetch failing rolled down and caused the last error You shouldn’t need to set a custom start command, and since you’re using gunicorn python main.py would not be correct please send your repo, the error you originally reported is caused by your project having an unconventional structure. I’d like to fix that up before we proceed
elysian-mv1
elysian-mv1OP11mo ago
here's the link https://github.com/romanjozaf/my-flask-app should be public
GitHub
GitHub - romanjozaf/my-flask-app
Contribute to romanjozaf/my-flask-app development by creating an account on GitHub.
Adam
Adam11mo ago
Your procfile is empty?
elysian-mv1
elysian-mv1OP11mo ago
that's strange, it't not empty in vs code - does git commit -m not automatically update all the files ?
Adam
Adam11mo ago
change your python file name to app, then add this to your Procfile
web: gunicorn app:app
web: gunicorn app:app
Then remove the start command on Railway if they’re saved, yes
elysian-mv1
elysian-mv1OP11mo ago
ah I see yes my procfile has that already, i'll see if i'm still getting an error
Adam
Adam11mo ago
to be clear, that should not fix any build errors. It’s just making sure you’re running a production-ready environment once we get to the deploy step
Brody
Brody11mo ago
the Procfile should be
web: gunicorn bnbuddy:app
web: gunicorn bnbuddy:app
since you don't have a main.py or app.py file. still won't fix build errors though
Adam
Adam11mo ago
I like renaming the main file to app so it’s standardized which is why I suggested that
elysian-mv1
elysian-mv1OP11mo ago
Seems to have deployed fine now Thanks for all the help
Adam
Adam11mo ago
glad to hear it, no prob
elysian-mv1
elysian-mv1OP11mo ago
Back again sadly - the app deployed fine, but when I click the url Railway gives me I get a ''Application failed to respond", the routing in my code seems to be fine and the build/deploy logs don't seem to point to any issue
Adam
Adam11mo ago
https://docs.railway.app/guides/fixing-common-errors please run through these docs, let me know if you have any issues
elysian-mv1
elysian-mv1OP11mo ago
thanks i'll take a look
elysian-mv1
elysian-mv1OP11mo ago
seems like python/gunicorn should be working by default
No description
elysian-mv1
elysian-mv1OP11mo ago
my procfile contains 'web: gunicorn main:app' not sure if I need 'gunicorn main:app' on a seperate line
Adam
Adam11mo ago
Nope that’s correct, Procfile formatting is web: startcommand
Brody
Brody11mo ago
check your deployment logs for errors
elysian-mv1
elysian-mv1OP11mo ago
deployment logs look all good - they're the exact same as when I load my app in vsc and test it locally
Brody
Brody11mo ago
you might have set a start command in the service settings, please remove it
elysian-mv1
elysian-mv1OP11mo ago
I had one in there and removed it, thought I had done so prior. Seems to have solved that issue but now I'm getting a 404
Brody
Brody11mo ago
can you send a link to the site?
Adam
Adam11mo ago
And there’s no logs? Aside from the regular ones
Brody
Brody11mo ago
do you have a route registered for the root?
elysian-mv1
elysian-mv1OP11mo ago
@Brody How would I go about checking that? Is that something I add into my code seperately?
Brody
Brody11mo ago
do you have an @app.route for /?
elysian-mv1
elysian-mv1OP11mo ago
like this?
No description
Brody
Brody11mo ago
yes that is a route decorator, if you don't have one for / then a 404 is very normal
elysian-mv1
elysian-mv1OP11mo ago
so I need another one for /
Brody
Brody11mo ago
why do you need a route for / all of a sudden after you have deployed to railway?
elysian-mv1
elysian-mv1OP11mo ago
I'm asking if I need one or if the code I sent should be fine
Brody
Brody11mo ago
im sorry but this is your code, if you need one then that is something you need to ask yourself
elysian-mv1
elysian-mv1OP11mo ago
getting this now
No description
Brody
Brody11mo ago
if you don't have a route for / then that's a totally normal thing to see what would you be expecting to see there?
elysian-mv1
elysian-mv1OP11mo ago
As mentioned in my original post I am new to this hence I am asking for guidance, might as well be asking a brick wall if it needs a route for /, I don't know that's why I'm here lol
Brody
Brody11mo ago
if you need a route for / that's entirely up to you, it has nothing to do with railway. this is a page your app is displaying, aka your app is working
Want results from more Discord servers?
Add your server