7 months ago
My client side says
websocket.js:39 WebSocket connection to 'wss://knowlify-backend-production.up.railway.app/socket.io/?EIO=4&transport=websocket' failed:
WebSocketClient.js:13 WebSocket connection to 'wss://www.knowlify.net:8080/ws' failed:
websocket.js:39 WebSocket connection to 'wss://knowlify-backend-production.up.railway.app/socket.io/?EIO=4&transport=websocket' failed:
websocket.js:39 WebSocket connection to 'wss://knowlify-backend-production.up.railway.app/socket.io/?EIO=4&transport=websocket' failed:
websocket.js:39 WebSocket connection to 'wss://knowlify-backend-production.up.railway.app/socket.io/?EIO=4&transport=websocket' failed:
I can't figure out the issue.
10 Replies
7 months ago
Hello,
I see a few things wrong.
1. You are running a development server for your frontend, this will have horrible performance and instabilities, not to mention it costs too much to run.
Here is an example of a production ready react app created from create-react-app -
https://github.com/brody192/create-react-app-starter
All you should need to do would be to copy the nixpacks.toml and Caddyfile into your frontend project folder.
2. Your backend's domain is pointing to the wrong port.
Please read our docs on this topic -
https://docs.railway.app/guides/fixing-common-errors#application-failed-to-respond
7 months ago
Where do I find what port I should connect to?
Edit: Never mind, found it. Let me try it out.
7 months ago
So I tried copying the files, but in the console it says "Starting the Development server". It doesn't seem like it was fixed.
7 months ago
You did not copy the files into the correct location then.
As a reminder, your frontend project resides in the /frontend/knowlify-site
folder.
7 months ago
Gotcha, fixed that.
I changed the port to look at the one in the environment variable and now it says my backend server is down. Specifically:
Application failed to respond
This error appears to be caused by the application.
If this is your project, check out your deploy logs to see what went wrong. Refer to our docs on Fixing Common Errors for help, or reach out over our Help Station.
If you are a visitor, please contact the application owner or try again later.
Request ID:
6TVYlWTlQTmyCt6t2TPpYA_882434190
My dockerfile is as follows, did I do something wrong?
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 --workers 4 --loop uvloop"]
7 months ago
Please read our docs on this topic -
https://docs.railway.app/guides/fixing-common-errors#application-failed-to-respond
7 months ago
I've read through it and cannot figure out why. I've put the port variable as you can see in the dockerfile.
7 months ago
Never mind, got it.
7 months ago
okay I fixed that. the issue now is that whenever i go to the website that my frontend is hosted on it crashes and shows a white screen. it never did that before the nixpacks stuff.
7 months ago
Well the warnings you are ignoring with CI=false
are there for a reason, I would recommend fixing the warnings.
From the console logs of the browser I get a Minified React error
meaning you have some kind of code issue.