Cannot access endpoint from outside railway
I am trying to create an endpoint in my service but I cant seem to access it from outside railway
3 Replies
Project ID:
88650658-638b-4d47-8fab-a98e65abea9a
88650658-638b-4d47-8fab-a98e65abea9a
This is how my docerfile looks like:
FROM python:3.9-slim
ENV PYTHONUNBUFFERED=1
WORKDIR /app
RUN apt-get update && apt-get install -y \
imagemagick \
libgl1-mesa-glx \
libglib2.0-0 \
libsm6 \
libxrender1 \
libxext6 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY policy.xml /etc/ImageMagick-6/policy.xml
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["hypercorn", "telegram-bot:app", "--bind", "0.0.0.0:3000"]
just realised I was using uvicorn inside the python script. Ive removed it completely and also added PORT to be 3000 in railway variables but I cant access the endpoint still
this is the address im trying to access http://buybotnotifications-production.up.railway.app:3000/update_found
This is also how my function looks like:
class ChatID(BaseModel): chat_id: int @app.post("/update_found") async def update_found(chat_data: ChatID): try: group_chat_id = chat_data.chat_id print(f"Received group_chat_id: {group_chat_id} for update_found") return {"message": "Success"} except Exception as e: print("ERROR IN ENDPOINT: ", e + " " + str(traceback.print_exc())) return {"message": "Error"}Ignore me I didnt had to put the port in the url and it worked
Solution
you need to use https without a port