Skip to content

Commit

Permalink
fix(scraper): fix puppeteer chromium not found
Browse files Browse the repository at this point in the history
  • Loading branch information
mytlogos committed Oct 27, 2022
1 parent ce8d270 commit b771e55
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG PROJECT_VERSION

RUN apk add --no-cache chromium wget curl grep unzip
RUN export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
RUN export PUPPETEER_EXECUTABLE_PATH=$(which chromium-browser)
RUN export PUPPETEER_EXECUTABLE_PATH=$(which chromium || which chromium-browser)

WORKDIR /code
COPY prepare-docker.sh ./
Expand Down
3 changes: 2 additions & 1 deletion packages/scraper/src/externals/request/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { handleCloudflare } from "./cloudflare";
import { CloudflareHandlerError, RequestError } from "./error";
import { ClientRequest } from "http";
import puppeteer from "puppeteer-extra";
import { HTTPRequest, HTTPResponse, Protocol, Browser, Page } from "puppeteer";
import { HTTPRequest, HTTPResponse, Protocol, Browser, Page, executablePath } from "puppeteer";
import puppeteerStealthPlugin from "puppeteer-extra-plugin-stealth";
import { getStoreValue, StoreKey } from "enterprise-core/dist/asyncStorage";
import { channel } from "diagnostics_channel";
Expand Down Expand Up @@ -132,6 +132,7 @@ class BrowserGetter {
// disable-gpu for headless environments, e.g. docker
this.#puppeteerBrowser ??= puppeteer.launch({
args: minimalArgs,
executablePath: executablePath(),
});
return this.#puppeteerBrowser;
}
Expand Down

0 comments on commit b771e55

Please sign in to comment.