deno-puppeteer
deno-puppeteer copied to clipboard
Buffer is not defined
Error: Uncaught ReferenceError: Buffer is not defined ? Buffer.from(postData).toString("base64")
Reason:
//this happens when listening to the "request" event
browser = await puppeteer.launch({headless:false});
const page = await browser.newPage();
page.setDefaultNavigationTimeout(0);
page.setRequestInterception(true);
page.on("request", (interceptedRequest) => {
interceptedRequest.continue({
method: "POST",
postData: new URLSearchParams(body).toString(),
headers: {
...interceptedRequest.headers(),
"Content-Type": "application/x-www-form-urlencoded",
},
});
});
await page.goto(url);
Hello ! I ran into the same issue, did you find a solution ?
Hello ! I ran into the same issue, did you find a solution ?
Not really, and I abandoned the project I was doing :(
Deno doesn't have a Buffer like nodejs, that is the problem. You'd have to polyfill it.
I have the same issue any solutions ?
error: Uncaught ReferenceError: Buffer is not defined ? Buffer.from(postData).toString("base64") ^ at HTTPRequest._HTTPRequest_continue (https://deno.land/x/[email protected]/vendor/puppeteer-core/puppeteer/common/HTTPRequest.js:716:9) at HTTPRequest.continue (https://deno.land/x/[email protected]/vendor/puppeteer-core/puppeteer/common/HTTPRequest.js:508:9) at file:///home/ibrahim/cf403/index.ts:37:30 at https://deno.land/x/[email protected]/vendor/puppeteer-core/puppeteer/common/Page.js:533:20 at eventLoopTick (ext:core/01_core.js:181:11) at async HTTPRequest.finalizeInterceptions (https://deno.land/x/[email protected]/vendor/puppeteer-core/puppeteer/common/HTTPRequest.js:300:5)
Hello! Ran into the same issue. Is it fair to say that appears for any intercepted request that sends back a customised response body?