nomagick commited on
Commit
ff76124
·
unverified ·
1 Parent(s): adce02d

chore: use env variable to switch browser headless mode

Browse files
Files changed (2) hide show
  1. .vscode/launch.json +21 -0
  2. src/services/puppeteer.ts +1 -1
.vscode/launch.json CHANGED
@@ -39,6 +39,27 @@
39
  "preLaunchTask": "Backend:build:watch",
40
  "killBehavior": "forceful"
41
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  {
43
  "name": "Debug Stand Alone Search",
44
  "request": "launch",
 
39
  "preLaunchTask": "Backend:build:watch",
40
  "killBehavior": "forceful"
41
  },
42
+ {
43
+ "name": "Debug Stand Alone Crawl + Browser",
44
+ "request": "launch",
45
+ "runtimeArgs": [
46
+ "--env-file=.secret.local",
47
+ ],
48
+ "env": {
49
+ "GCLOUD_PROJECT": "reader-6b7dc",
50
+ "DEBUG_BROWSER": "true",
51
+ "LD_PRELOAD": "/usr/local/lib/libcurl-impersonate-chrome.dylib"
52
+ },
53
+ "cwd": "${workspaceFolder}",
54
+ "program": "build/stand-alone/crawl.js",
55
+ "skipFiles": [
56
+ "<node_internals>/**"
57
+ ],
58
+ "type": "node",
59
+ "outputCapture": "std",
60
+ "preLaunchTask": "Backend:build:watch",
61
+ "killBehavior": "forceful"
62
+ },
63
  {
64
  "name": "Debug Stand Alone Search",
65
  "request": "launch",
src/services/puppeteer.ts CHANGED
@@ -561,7 +561,7 @@ export class PuppeteerControl extends AsyncService {
561
  }
562
  this.browser = await puppeteer.launch({
563
  timeout: 10_000,
564
- headless: true,
565
  executablePath: process.env.OVERRIDE_CHROME_EXECUTABLE_PATH,
566
  args: ['--disable-dev-shm-usage']
567
  }).catch((err: any) => {
 
561
  }
562
  this.browser = await puppeteer.launch({
563
  timeout: 10_000,
564
+ headless: !Boolean(process.env.DEBUG_BROWSER),
565
  executablePath: process.env.OVERRIDE_CHROME_EXECUTABLE_PATH,
566
  args: ['--disable-dev-shm-usage']
567
  }).catch((err: any) => {