browser-rendering text() throws "✘ ...ReferenceError: Buffer is not defined..."

Hey all! Trying to use the "browser-rendering" feature to get the text of a page - the docs demo it at https://developers.cloudflare.com/browser-rendering/get-started/reuse-sessions/ - but when I call response.text myself (copy/pasting the code from the docs), I get an error saying Buffer is not defined - deep inside the CF Pupeteer package:
✘ [ERROR] Uncaught (in promise) ReferenceError: Buffer is not defined

at null.<anonymous>
(file:///Users/josiahbryan/devel/rubber/cfworkers/browser-worker/node_modules/@cloudflare/puppeteer/src/common/HTTPResponse.ts:206:11)
✘ [ERROR] Uncaught (in promise) ReferenceError: Buffer is not defined

at null.<anonymous>
(file:///Users/josiahbryan/devel/rubber/cfworkers/browser-worker/node_modules/@cloudflare/puppeteer/src/common/HTTPResponse.ts:206:11)
Any suggestions on what I'm doing wrong...? Does response.text() just NOT work? Usage is like:
const response = await page.goto(url, { waitUntil: 'networkidle2' });
// ...
const text = await response.text(); // <~--- "Buffer is not defined" error thrown here
const response = await page.goto(url, { waitUntil: 'networkidle2' });
// ...
const text = await response.text(); // <~--- "Buffer is not defined" error thrown here
(This is happening when running the worker via npx wrangler dev --remote)
0 Replies
No replies yetBe the first to reply to this messageJoin