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
Project ID:
e1307a79-f324-4e06-b4ad-eae0f4a820a9
Project ID:
e1307a79-f324-4e06-b4ad-eae0f4a820a9
e1307a79-f324-4e06-b4ad-eae0f4a820a9
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/
Do you have set a start command in the service settings?
@Medim I can't seem to find a place to enter a start command in my project settings
You enter start command in service settings
@madhdsua
Its on the service settings, not the project
Services are the block-like containers located inside your Project
here
i've tried 'npm run start' and still getting the same error
But its a Flask app...
that's a start command for a nodejs project
you'd need to use the same command you use to run it locally
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
I'd expect the command to be something like
python main.py
Postman just makes the request
ok progess has been made - 'python main.py' worked
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...'
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 proceedGitHub
GitHub - romanjozaf/my-flask-app
Contribute to romanjozaf/my-flask-app development by creating an account on GitHub.
Your procfile is empty?
that's strange, it't not empty in vs code - does git commit -m not automatically update all the files ?
change your python file name to app, then add this to your Procfile
Then remove the start command on Railway
if they’re saved, yes
ah I see
yes my procfile has that already, i'll see if i'm still getting an error
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
the Procfile should be
since you don't have a main.py or app.py file.
still won't fix build errors though
I like renaming the main file to app so it’s standardized
which is why I suggested that
Seems to have deployed fine now
Thanks for all the help
glad to hear it, no prob
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
https://docs.railway.app/guides/fixing-common-errors
please run through these docs, let me know if you have any issues
thanks i'll take a look
seems like python/gunicorn should be working by default
my procfile contains 'web: gunicorn main:app' not sure if I need 'gunicorn main:app' on a seperate line
Nope that’s correct, Procfile formatting is web: startcommand
check your deployment logs for errors
deployment logs look all good - they're the exact same as when I load my app in vsc and test it locally
you might have set a start command in the service settings, please remove it
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
can you send a link to the site?
And there’s no logs? Aside from the regular ones
do you have a route registered for the root?
@Brody How would I go about checking that? Is that something I add into my code seperately?
do you have an
@app.route
for /
?like this?
yes that is a route decorator, if you don't have one for
/
then a 404 is very normalso I need another one for /
why do you need a route for
/
all of a sudden after you have deployed to railway?I'm asking if I need one or if the code I sent should be fine
im sorry but this is your code, if you need one then that is something you need to ask yourself
getting this now
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?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
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