solved puppeter problem in railway

This commit is contained in:
2022-11-12 18:58:59 -03:00
parent 23ee708a14
commit ee340cb9c5
3 changed files with 65 additions and 1 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
node_modules
yarn.lock
.env
package-lock.json

View File

@@ -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' });

61
nixpacks.json Normal file
View File

@@ -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"
}
}