Josiah Bryan
Josiah Bryan
CDCloudflare Developers
Created by Josiah Bryan on 4/22/2024 in #workers-help
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)
1 replies
CDCloudflare Developers
Created by Josiah Bryan on 2/17/2023 in #workers-help
POST to worker > "Network connection lost" (via 'wrangler tail')
POST https://valet-ticket-list.vaya.workers.dev/vstnd_6t84ks2nvu5xqo3hhp1p2otpj/vtkt_d2u4wh8ulv8gzmc5wqx8bzcho/ChangeTicketStatus - Exception Thrown @ 2/16/2023, 7:34:06 PM ✘ [ERROR] Error: Network connection lost. Not posting a huge body - content-length is only 46 ...I thought maybe there was something really large being posted as hinted on an SO thread (workers consuming large posts ran out of RAM) but this one doesn't seem to be happening. Any ideas on why I'm getting this odd error...?
5 replies