Hey, I would like access to the browser-rendering-api-beta
Hey, I would like access to the browser-rendering-api-beta
wrangler.toml
nodejs_compat compatibility flag, not node_compat.readable is not async iterable, I narrowed it down to the const pdf = await page.pdf(); line but have no clue how I could resolve the issue. Anyone that could help me?puppeteer.launch(this.env.BROWSER)). state.blockConcurrencyWhile(() ={ throw new Error("Intentional crash")) } in the constructor, but even that doesn't help.Unable is misspelled Unabled in that error message shopping-birdCustomers on our Free plans can only submit tickets for billing, account, and registrar issues., even though I'm paying $5 a month for the plan with workers and DO
puppeteer.launch(). You can reuse the session as explained with DOs in the blogpost which would make it where you can pay per minute with only the initial request warming up the DO costing or anytime the DO gets reset (should mostly code updates / runtime updates)export interface Env {
MYBROWSER: Fetcher;
}
import puppeteer from '@cloudflare/puppeteer';
export default {
async fetch(request: Request, env: Env): Promise<Response> {
const { searchParams } = new URL(request.url);
let url = searchParams.get('url');
// skip favicon requests
if (request.url.includes('/favicon.ico')) return new Response('Not found', { status: 404 });
if (url) {
const browser = await puppeteer.launch(env.MYBROWSER);
const page = await browser.newPage();
await page.goto(url);
const pdf = await page.pdf();
await browser.close();
if (!pdf) return new Response('No pdf found', { status: 404 });
return new Response(pdf, {
headers: {
'content-length': pdf.byteLength.toString(),
'content-type': 'application/pdf',
},
});
} else {
return new Response('Please add the ?url=https://example.com/ parameter');
}
},
};