how to convert puppeteer.HTTPResponse to cloudflare Response
I am trying to convert a puppeteer.HTTPResponse into a cloudflare response. Before I moved to cloudflare workers, I was able to do this with the following code. However, currently with cloudflare I get the following error:
ReferenceError: Buffer is not defined
ReferenceError: Buffer is not defined
Code that previously worked:
const response = await page.goto(request.url);if (!response) { throw new Error(`Request to ${request.url} failed.`);}return new Response(await response.text(), { status: response.status(),});
const response = await page.goto(request.url);if (!response) { throw new Error(`Request to ${request.url} failed.`);}return new Response(await response.text(), { status: response.status(),});