diff --git a/packages/core.gbapp/services/GBSSR.ts b/packages/core.gbapp/services/GBSSR.ts index 075da8a0..ff778ac0 100644 --- a/packages/core.gbapp/services/GBSSR.ts +++ b/packages/core.gbapp/services/GBSSR.ts @@ -81,22 +81,24 @@ const RENDER_CACHE = new Map(); -async function createBrowser(profile): Promise<any> { - const gbaiName = `${this.min.botId}.gbai`; - let localName = Path.join('work', gbaiName, 'profile'); +async function createBrowser(profilePath): Promise<any> { + + let args = [ + '--ignore-certificate-errors', + '--no-sandbox', + '--disable-setuid-sandbox', + '--window-size=1920,1080', + "--disable-accelerated-2d-canvas", + "--disable-gpu", + "--disable-features=site-per-process" + ]; + + if (profilePath){ + args.push(`--user-data-dir=${profilePath}`); + } const browser = await puppeteer.launch({ - args: [ - '--ignore-certificate-errors', - '--no-sandbox', - '--disable-setuid-sandbox', - '--window-size=1920,1080', - "--disable-accelerated-2d-canvas", - "--disable-gpu", - "--disable-features=site-per-process", - `--user-data-dir=${localName}` - - ], + args: args, ignoreHTTPSErrors: true, headless: false, }); diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts index 56856c6d..df67ee8c 100644 --- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts +++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts @@ -136,10 +136,10 @@ export class WhatsappDirectLine extends GBService { // Initialize the browser using a local profile for each bot. const gbaiName = `${this.min.botId}.gbai`; - let localName = Path.join('work', gbaiName, 'profile'); + const localName = Path.join('work', gbaiName, 'profile'); - const browser = await createBrowser(null); - let client = this.customClient = new Client({ + const browser = await createBrowser(localName); + const client = this.customClient = new Client({ authStrategy: new LocalAuth({ clientId: this.min.botId, dataPath: localName