You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Puppeteer with the puppeteer-extra package and the puppeteer-extra-plugin-adblocker plugin in my Node.js project, which is deployed on Google Cloud Functions. I have a function takeScreenshotWithOptions that takes a Params object, including a block_ads parameter. However, I am experiencing inconsistent ad blocking behavior.
When I set block_ads to true or false, the ad blocking behavior is inconsistent. Sometimes ads are blocked with both settings until I restart the server.
Reproduction Steps:
Set block_ads to false and observe ad blocking behavior.
Set block_ads to true and observe ad blocking behavior.
Repeat steps 1 and 2 to see if the behavior is consistent or changes over time.
Expected Behavior:
When block_ads is set to true, ads should be blocked.
When block_ads is set to false, ads should not be blocked.
Actual Behavior:
Sometimes ads are blocked even when block_ads is set to false
Environment:
Node.js version: “18.20.1”,
puppeteer: "^22.6.4",
puppeteer-extra: "^3.3.6",
puppeteer-extra-plugin-adblocker: "^2.13.6"
Additional Information:
Restarting the server temporarily resolves the issue, but it reappears after some time.
Sample Code:
index.ts
import * as ff from '@google-cloud/functions-framework';
import { takeScreenshotWithOptions } from './screenshot';
ff.http('TypescriptFunction', async (req:ff.Request, res:ff.Response) => {
try {
const result = await takeScreenshotWithOptions(req.body);
res.status(200).send(JSON.stringify({
'screenshotUrl': result
}));
} catch (error) {
console.error(error);
res.status(500).send('Errors taking screenshot');
}
});
I hope to understand why the ad blocking behavior is inconsistent and find a reliable solution to ensure that ads are blocked or unblocked based on the block_ads parameter.
The text was updated successfully, but these errors were encountered:
Completely random suggestion which may or may not work;
I think I saw in another thread somewhere that you have to make a new page via await browser.newPage() for some reason, cant use (await browser.pages())[0]
Description:
I am using Puppeteer with the puppeteer-extra package and the puppeteer-extra-plugin-adblocker plugin in my Node.js project, which is deployed on Google Cloud Functions. I have a function takeScreenshotWithOptions that takes a Params object, including a block_ads parameter. However, I am experiencing inconsistent ad blocking behavior.
When I set block_ads to true or false, the ad blocking behavior is inconsistent. Sometimes ads are blocked with both settings until I restart the server.
Reproduction Steps:
Expected Behavior:
Actual Behavior:
Environment:
Additional Information:
Sample Code:
index.ts
takeScreenshotWithOptions.ts
Expected Outcome:
I hope to understand why the ad blocking behavior is inconsistent and find a reliable solution to ensure that ads are blocked or unblocked based on the block_ads parameter.
The text was updated successfully, but these errors were encountered: