a year ago
When I visit my backend server online through its link, I run into this error:
Failed to load resource: the server responded with a status of 404 ()
When it was working before it would say method not available when I used to type in one of my endpoints but now it just says 404 error and I'm not sure what's wrong. I'm listening to the PORT variable. when running my Dockerfile too.
5 Replies
a year ago
Hey there and Happy Monday!
This doesn't seem like a Railway-specific error. Here's a couple of things you could try to debug the issue:
1) Have you tried running the app locally, and then in a container, and seeing if you are able to access those endpoints?
2) Re-trace your steps back and see what changed about the / endpoint that you were able to see it but now you don't. I'd then advise checking what the different between the / endpoint (which was then accessible) and the endpoint you were trying to access before was to spot what might be missing
3) Check out any of our Python templates for inspiration and seeing what you could be missing:
https://railway.app/templates?q=python
Status changed to Awaiting User Response Railway • over 1 year ago
a year ago
I did it so long ago that I don't remember what changes I had made. I'll do what you said in #1, but wanted to ask if you see anything wrong in my Dockerfile. Just want to make sure I'm not doing anything dumb.
FROM python:3.10.2-slim
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV GOOGLE_APPLICATION_CREDENTIALS="/app/service_key.json"
RUN apt-get update && apt-get install -y \
libgl1-mesa-glx \
libglib2.0-0 \
poppler-utils \
tesseract-ocr \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install python-multipart
COPY service_key.json /app/
COPY / /app/
CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port $PORT"]Status changed to Awaiting Railway Response Railway • over 1 year ago
a year ago
If you happen to have it in your git history, that might help? The Dockerfile looks good to me. You can check out our FastAPI basic starter template (https://docs.railway.app/guides/fastapi#use-a-dockerfile) and see if you might be missing something (code: https://github.com/railwayapp-templates/fastapi/blob/main/README.md)
Status changed to Awaiting User Response Railway • over 1 year ago
a year ago
i figured it out, now the issue is that when i open my frontend link it says application failed to respond. i went through the railway guide for this and how they made sure you listen to the port but it still has an issue, so I'm not sure what to do from there.
Status changed to Awaiting Railway Response Railway • over 1 year ago
a year ago
I see a bunch of Method Not Allowed's in your deploy logs — have you tried debugging from there?
I'd recommend going step by step to get this up and running, you can do this! Refer to the build and deploy logs, Google and looking into the errors you run into (Stackoverflow is usually a great resource) and go from there!
It could also help to make sure all this is working locally and on Docker locally, so you can rule out some of other obvious non-Railway specific issues.
Status changed to Awaiting User Response Railway • over 1 year ago
7 months ago
This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!
Status changed to Solved Railway • 7 months ago