Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Cannot connect to chrome #82

Open
ARezaK opened this issue Dec 30, 2022 · 5 comments
Open

Cannot connect to chrome #82

ARezaK opened this issue Dec 30, 2022 · 5 comments
Labels
question Further information is requested

Comments

@ARezaK
Copy link

ARezaK commented Dec 30, 2022

Intermittently having this error. Will try to start up a session and seems to work the first couple of times and then will stop working. Running in docker with ubuntu. Restarting the docker container fixes the issue for a while
image

My code:

api1 = ChatGPT(session_token)  # auth with session token
summary = api1.send_message(msg_to_send)
print(summary)
if "I'm sorry" in summary['message']:
    raise Exception("ChatGPT could not get information")
# save summary to file
with open('data/' + ticker + '.summary' + '.txt', 'w+') as outfile:
    outfile.write(summary['message'])
api1.__del__()
@terry3041
Copy link
Owner

Can you show your Dockerfile?

@terry3041 terry3041 added the question Further information is requested label Dec 31, 2022
@kimkimkeren
Copy link

Same problem here, but I'm running using aws lambda instead of ubuntu

My dockerfile :

FROM public.ecr.aws/lambda/python:3.9

COPY lambda_function.py ${LAMBDA_TASK_ROOT}

RUN yum install -y wget
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
RUN yum install -y ./google-chrome-stable_current_*.rpm
RUN yum install -y xorg-x11-server-Xvfb gcc-c++
RUN pip3 install pychatgpt tweepy ffmpeg_downloader PyPasser pocketsphinx

CMD [ "lambda_function.lambda_handler" ]

@terry3041
Copy link
Owner

Same problem here, but I'm running using aws lambda instead of ubuntu

Should be related to this: ultrafunkamsterdam/undetected-chromedriver#643
Try manually install undetected-chromedriver by pip3 install undetected-chromedriver==3.2.1.
I will bump the version of uc later on.

@ARezaK
Copy link
Author

ARezaK commented Dec 31, 2022

My Dockerfile


FROM ubuntu:focal

# Set the working directory to /app
WORKDIR /app

# Copy the current directory contents into the container at /app
ADD . /app

ENV NAME DOCKER
ENV DEBIAN_FRONTEND=noninteractive
# Prevents Python from buffering stdout and stderr (equivalent to python -u option)
ENV PYTHONUNBUFFERED 1
# Prevents Python from writing pyc files to disc (equivalent to python -B option)
ENV PYTHONDONTWRITEBYTECODE 1

RUN apt-get update && apt-get install -y \
	python3-dev \
	python3-pip \
	apt-utils \
    xvfb \
    wget

# for installing chrome
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt install -y ./google-chrome-stable_current_amd64.deb


EXPOSE 5000

COPY requirements.txt /app/requirements.txt

RUN pip3 --no-cache-dir install -r /app/requirements.txt
RUN apt-get update && apt-get install -y build-essential && apt-get install -y wget


CMD gunicorn app:app --timeout 600 --worker-class gevent --bind 0.0.0.0:5000 --reload

@kimkimkeren
Copy link

Same problem here, but I'm running using aws lambda instead of ubuntu

Should be related to this: ultrafunkamsterdam/undetected-chromedriver#643 Try manually install undetected-chromedriver by pip3 install undetected-chromedriver==3.2.1. I will bump the version of uc later on.

after adding undetected-chromedriver==3.2.1, the problem still persists here

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants