CF Worker Puppeeter: Cannot read properties of undefined (reading 'fetch')
Hi I'm getting this error still after following the Docs https://developers.cloudflare.com/browser-rendering/get-started/screenshots/
It happens locally with
wrangler dev --remote
and in production.
My src/index.js
:
My wrangler.toml
:
https://discord.com/channels/595317990191398933/1243398977592889416/1243398977592889416Cloudflare Docs
Deploy a Browser Rendering Worker | Browser Rendering docs
By following this guide, you will create a Worker that uses the Browser Rendering API to take screenshots from web pages. This is a common use case for browser automation.
2 Replies
Would suggest adding a kv binding to your wrangler.toml, uncomment the lines of code in your fetch handler, and test to see if you get the same error.
thanks, but I just found out the issue. My browser binding was wrongly named
const browser = await puppeteer.launch(env.MYBROWSER);
should've been const browser = await puppeteer.launch(env.MY_BROWSER);