MrBithles
MrBithles
CDCloudflare Developers
Created by MrBithles on 11/7/2024 in #workers-help
Browser Rendering Env Binding in local dev is not set?
In my local wranger dev I can see logs saying it will bind browser but when I print out env from fetch or queue param its undefined. I assume it's why I am seeing this error trying to launch puppeteer.
const browser = await puppeteer.launch(env.CRAWLER_BROWSER);
const browser = await puppeteer.launch(env.CRAWLER_BROWSER);
✘ [ERROR] TypeError: Cannot read properties of undefined (reading 'fetch') at PuppeteerWorkers.launch
⛅️ wrangler 3.85.0
-------------------

Your worker has access to the following bindings:
- Durable Objects:
- MY_DURABLE_OBJECT: MyDurableObject
- Queues:
- CRAWLER_QUEUE: queues-crawler (local)
- Browser:
- Name: CRAWLER_BROWSER
- AI:
- Name: AI
╭───────────────────────────╮
│ [b▲ [WARNING] Using Workers AI always accesses your Cloudflare account in order to run AI models, and so will incur usage charges even in local development.

⎔ Starting local server...
[wrangler:inf] Ready on http://localhost:8787
Recieved fetch request env: {
AI: Ai {
fetcher: Fetcher {},
logs: [],
options: {},
lastRequestId: null,
aiGatewayLogId: null
},
MY_DURABLE_OBJECT: DurableObjectNamespace {},
CRAWLER_QUEUE: WorkerQueue {}
}
⛅️ wrangler 3.85.0
-------------------

Your worker has access to the following bindings:
- Durable Objects:
- MY_DURABLE_OBJECT: MyDurableObject
- Queues:
- CRAWLER_QUEUE: queues-crawler (local)
- Browser:
- Name: CRAWLER_BROWSER
- AI:
- Name: AI
╭───────────────────────────╮
│ [b▲ [WARNING] Using Workers AI always accesses your Cloudflare account in order to run AI models, and so will incur usage charges even in local development.

⎔ Starting local server...
[wrangler:inf] Ready on http://localhost:8787
Recieved fetch request env: {
AI: Ai {
fetcher: Fetcher {},
logs: [],
options: {},
lastRequestId: null,
aiGatewayLogId: null
},
MY_DURABLE_OBJECT: DurableObjectNamespace {},
CRAWLER_QUEUE: WorkerQueue {}
}
2 replies