Application failed to respond

kevinkeyssx
HOBBY

a year ago

I am encountering an issue with my Railway deployment. Upon deploying my application, all dependencies specified in the requirements.txt file are successfully installed, and the application compiles without any errors. However, when attempting to access the API, I am greeted with the error message "Application failed to respond." Unfortunately, the deployment logs provide minimal insight into the root cause of this issue, as they only display the message: "No deployment logs. All output sent to stdout will be displayed here."

Solved

9 Replies

a year ago

What kind of python app do you have?


kevinkeyssx
HOBBY

a year ago

Sorry, yes it's a Python application, I'm using the FastAPI framework.


a year ago

What's your current start command?


kevinkeyssx
HOBBY

a year ago

I'm using the default commands and it detects my Dockerfile. I added this file because without it, I get the same error. I was trying with basic Docker commands but it doesn't work either.

FROM python:3.9-slim

WORKDIR /app

RUN apt-get update && apt-get install -y libpq-dev gcc

COPY requirements.txt .

RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD ["python", "main.py"]


a year ago

Try changing the CMD line to -

CMD uvicorn main:app --host 0.0.0.0 --port $PORT

Status changed to Solved Railway over 1 year ago


kevinkeyssx
HOBBY

a year ago

I have a file called Procfile with the same command

web: uvicorn main:app --host 0.0.0.0 --port $PORT


a year ago

A Procfile is a heroku thing, go ahead and delete that and try my suggested change.


kevinkeyssx
HOBBY

a year ago

This worked for me:

CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port $PORT"]

Thank you very much for your assistance.


a year ago

Writing out CMD without the brackets also evaluates the command in the shell before running it.