2 years ago
Hey so my code works fine (code below) locally but in Railway hosted I am getting the below error, anyway I can fix this?
Essentially I am using playwright to scrape some data and return it via the python API
curl -X POST "xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"url": "xxxxxxx
{"detail":"Connection closed while reading from the driver"}%```
Code attached48 Replies
2 years ago
you can check your HTTP logs for more information
/opt/venv/lib/python3.9/site-packages/playwright/driver/node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.36' not found (required by /nix/store/xpxln7rqi3pq4m0xpnawhxb2gs0mn1s0-gcc-12.3.0-lib/lib/libstdc++.so.6)
2 years ago
you mean write your own dockerfile?
2 years ago
its complicated for the most part, i'd recommend moving to a dockerfile, i can give your Dockerfile a once over after you write it?
Appreciate it, never really used docker tbh, I should learn it at some point. WIll build one and send it if I run into issue sthanks
2 years ago
sounds good!
2 years ago
additionally, would you be interested in using browserless? not having to install and bundle chrome into your container would decrease the build time, and also decrease the publish times!
2 years ago
ah perfect, i just saw playwright and thought chrome install, my bad
2 years ago
with a Dockerfile? that was fast
FROM mcr.microsoft.com/playwright:v1.38.0-focal
# Install Python and pip
RUN apt-get update && apt-get install -y python3 python3-pip
# Set the working directory
WORKDIR /app
# Copy the requirements file
COPY requirements.txt .
# Install the Python dependencies
RUN pip3 install --no-cache-dir -r requirements.txt
# Copy the rest of the application code
COPY . .
# Install Playwright browsers and dependencies
RUN playwright install chromium
RUN playwright install-deps
# Set the command to run the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]2 years ago
not ideal, you are using BrightData yet you are installing chrome now
2 years ago
you are also installing python from apt-get, thats not a super stable install path for installing programming languages
Ah your right, stupid of me to confuse that. I wonder if I am not using brightdata correctly which prompted the need for this
2 years ago
well first off, simply try removing those two playwright commands
2 years ago
okay now instead of FROM playwright and then installing python with apt-get, you can do FROM python with a version
{"detail":"BrowserType.connect_over_cdp: WebSocket error: wss://xxxxxxxx@brd.superproxy.io:9222/ 401 Auth Failed (ip_blacklisted: 34.105.6.0/24)\nAuth Failed ip_blacklisted: 34.105.6.0/24\nCall log:\n wss://xxxxxxxx@brd.superproxy.io:9222/\n - wss://xxxxxxxx@brd.superproxy.io:9222/ 401 Auth Failed (ip_blacklisted: 34.105.6.0/24)\nAuth Failed ip_blacklisted: 34.105.6.0/24\n - wss://xxxxxxxx@brd.superproxy.io:9222/ error WebSocket was closed before the connection was established\n - wss://xxxxxxxx@brd.superproxy.io:9222/ WebSocket was closed before the connection was established\n - wss://xxxxxxxx@brd.superproxy.io:9222/ code=1006 reason=\n"}% ```
2 years ago
very possible, but its also a 401 instead of 403, so maybe your credentials are wrong / expired?
2 years ago
Gotcha, do you have static Ips enabled?
2 years ago
on your railway service, check the service settings
2 years ago
try enabling that
2 years ago
ah then you would need to get in contact with them
2 years ago
correct
Thanks for info Brody. Any info I can provide that will help them? Like any info about yoru servr or IP ranges or etc?
2 years ago
you have a static IP now, so that's all you'd need to give them
Perfect thanks again. I always feel confident in my knowledge until I run into these issues then remeber I have so muc more to learn 🙂 Appreciate your pateince with me.
2 years ago
I wish I could help here but unfortunately an IP ban is outside of what we can control