Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errno::ENOENT (No such file or directory - lsof) on Production Deploy or Docker Locally #14

Open
est1213 opened this issue Jan 12, 2025 · 0 comments

Comments

@est1213
Copy link

est1213 commented Jan 12, 2025

My scraping app is working great locally, but when deploying it I consistently get this;

INFO -- : Spider: started: duvall
DEBUG -- : BrowserBuilder (selenium_firefox): created browser instance
DEBUG -- : BrowserBuilder (selenium_firefox): enabled before_request.delay
DEBUG -- : Browser: sleep 1 second before request...
DEBUG -- : BrowserBuilder (selenium_firefox): enabled custom user_agent
DEBUG -- : BrowserBuilder (selenium_firefox): enabled native headless_mode
INFO -- : Browser: started get request to: (url)
INFO -- : Browser: finished get request to: (url)
INFO -- : Info: visits: requests: 1, responses: 1
INFO -- : Browser: driver selenium_firefox has been destroyed
FATAL -- : Spider: stopped: {spider_name: "duvall", status: :failed, error: "#<Errno::ENOENT: No such file or directory - lsof>", environment: "development", start_time: 2025-01-12 00:24:48.900533401 +0000, stop_time: 2025-01-12 00:24:54.745870904 +0000, running_time: "5s", visits: {requests: 1, responses: 1}, items: {sent: 0, processed: 0}, events: {requests_errors: {}, drop_items_errors: {}, custom: {}}}
 Completed 500 Internal Server Error in 5854ms (ActiveRecord: 0.0ms | Allocations: 148808)

I tried putting the app in a Docker container thinking perhaps that my app wasn't able to access the drivers on my hosting service, but am still getting the same error with it running from the Docker container as well, and this time locally. I have the same installation in my Dockerfile as listed in the installation steps with the exceptions that I was prompted to use Geckdriver 0.35.0, and Firefox installation was reporting "'firefox' has no installation candidate", so I used firefox-esr.

# Install basic tools
RUN apt install -q -y unzip wget tar openssl

# Install xvfb (for virtual_display headless mode, in additional to native)
RUN apt install -q -y xvfb

# Install chromium-browser and firefox
RUN apt install -q -y chromium firefox-esr

# Instal chromedriver (2.44 version)
# All versions are located here: https://sites.google.com/a/chromium.org/chromedriver/downloads
RUN wget https://chromedriver.storage.googleapis.com/2.44/chromedriver_linux64.zip
RUN unzip chromedriver_linux64.zip -d /usr/local/bin
RUN rm -f chromedriver_linux64.zip

# Install geckodriver (0.23.0 version)
# All versions are located here: https://github.com/mozilla/geckodriver/releases/
RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.35.0/geckodriver-v0.35.0-linux64.tar.gz
RUN tar -xvzf geckodriver-v0.35.0-linux64.tar.gz -C /usr/local/bin
RUN rm -f geckodriver-v0.35.0-linux64.tar.gz

# Install PhantomJS (2.1.1)
# All versions are located here: http://phantomjs.org/download.html
RUN apt install -q -y chrpath libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev
RUN wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
RUN tar -xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2
RUN mv phantomjs-2.1.1-linux-x86_64 /usr/local/lib
RUN ln -s /usr/local/lib/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin
RUN rm -f phantomjs-2.1.1-linux-x86_64.tar.bz2

When run locally, the next log line that comes up where the deployed/Docker don't get to is;

DEBUG -- : Browser: driver.current_memory: (numbers)

I tried using selenium_chrome instead of selenium_firefox, that fails with the error;

#<Selenium::WebDriver::Error::WebDriverError: no sessionId in returned payload>
@est1213 est1213 changed the title Errno::ENOENT (No such file or directory - lsof) on Prod Deploy or Docker Locally Errno::ENOENT (No such file or directory - lsof) on Production Deploy or Docker Locally Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant