Browser Rendering worker re-executes before timing out
👋 I'm running browser rendering to scrape pdfs. Running wrangler dev locally ($ npm run dev -- --remote -e stage --test-scheduled) and triggering scheduled event with $ curl "http://localhost:8787/__scheduled", once the worker execution time hits around 80 seconds, it starts executing all over again as if the curl was called again - but it wasn't called again. Is this by design in workers?
cc: @Walshy
3 Replies
That sounds like a bug
i'd recommend filing a report in https://github.com/cloudflare/workers-sdk/issues with a repro
I also have a problem where my worker executes twice. For me it runs again immediately after the first run is done (which takes a few seconds). Did you manage to solve this yet?
Edit: It seems for me it was because of the browser favicon. Since you load through curl, it's unlikely that we have the same issue.
Hello! Did you fixed it some how? I have the same problem( I created simple example and it started twice. This is my example:
import puppeteer from "@cloudflare/puppeteer";
export default {
async fetch(request, env, ctx) {
console.log('START');
let url = 'https://www.google.com';
const browser = await puppeteer.launch(env.TEST);
const page = await browser.newPage();
// await page.goto(url);
try {
await page.waitForSelector('div#test123', {hidden: false});
} catch (e) {
console.log('WAITING 1')
}
try {
await page.waitForSelector('div#test123', {hidden: false});
} catch (e) {
console.log('WAITING 2')
}
try {
await page.waitForSelector('div#test123', {hidden: false});
} catch (e) {
console.log('WAITING 3')
}
await browser.close();
return new Response('Hello World!');
},
};