diff --git a/.gitignore b/.gitignore index c580a33..dad9065 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules yarn.lock .env +package-lock.json \ No newline at end of file diff --git a/commands/price.js b/commands/price.js index 8c8610a..9b0cbac 100644 --- a/commands/price.js +++ b/commands/price.js @@ -162,7 +162,9 @@ module.exports = { const pagesWithErrorScrapping = []; for (const countryPage of countryPages) { try { - const browser = await puppeteer.launch() ; + const browser = await puppeteer.launch({ + args: ['--no-sandbox'], + }) ; const page = await browser.newPage(); const searchUrl = countryPage.searchUrl.replace('%S', product); const response = await page.goto(searchUrl, { waitUntil: 'domcontentloaded' }); diff --git a/nixpacks.json b/nixpacks.json new file mode 100644 index 0000000..079d0e9 --- /dev/null +++ b/nixpacks.json @@ -0,0 +1,61 @@ +{ + "providers": [], + "buildImage": "ghcr.io/railwayapp/nixpacks:debian-1667866002", + "variables": { + "CI": "true", + "NIXPACKS_METADATA": "node", + "NODE_ENV": "production", + "NPM_CONFIG_PRODUCTION": "false" + }, + "phases": { + "build": { + "dependsOn": [ + "install" + ], + "cacheDirectories": [ + "node_modules/.cache" + ] + }, + "install": { + "dependsOn": [ + "setup" + ], + "cmds": [ + "yarn install --frozen-lockfile && node node_modules/puppeteer/install.js" + ], + "cacheDirectories": [ + "/usr/local/share/.cache/yarn/v6" + ], + "paths": [ + "/app/node_modules/.bin" + ] + }, + "setup": { + "nixPkgs": [ + "nodejs-18_x", + "yarn-1_x" + ], + "nixOverlays": [ + "https://github.com/railwayapp/nix-npm-overlay/archive/main.tar.gz" + ], + "nixpkgsArchive": "a0b7e70db7a55088d3de0cc370a59f9fbcc906c3", + "aptPkgs": [ + "chromium", + "libnss3", + "libatk1.0-0", + "libatk-bridge2.0-0", + "libcups2", + "libgbm1", + "libasound2", + "libpangocairo-1.0-0", + "libxss1", + "libgtk-3-0", + "libxshmfence1", + "libglu1" + ] + } + }, + "start": { + "cmd": "yarn run start" + } +} \ No newline at end of file