Application failed to respond
kevinkeyssx
HOBBYOP

2 years 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

brody
EMPLOYEE

2 years ago

What kind of python app do you have?


kevinkeyssx
HOBBYOP

2 years ago

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


brody
EMPLOYEE

2 years ago

What's your current start command?


kevinkeyssx
HOBBYOP

2 years 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"]


brody
EMPLOYEE

2 years 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
HOBBYOP

2 years ago

I have a file called Procfile with the same command

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


brody
EMPLOYEE

2 years ago

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


kevinkeyssx
HOBBYOP

2 years 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.


brody
EMPLOYEE

2 years ago

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


Loading...