bulk88
05/24/2023, 9:30 PMbulk88
05/24/2023, 9:34 PMbulk88
05/24/2023, 9:34 PMbulk88
05/24/2023, 9:35 PMScarabCoder
05/24/2023, 9:55 PMlastguru
05/24/2023, 10:01 PMlastguru
05/24/2023, 10:02 PMScarabCoder
05/24/2023, 10:03 PMlastguru
05/24/2023, 10:03 PMScarabCoder
05/24/2023, 10:04 PMsilentdevnull
05/24/2023, 10:29 PM✘ [ERROR] Expected ")" but found ":"
src/index.js:4:23:
4 │ async fetch(request: Request, env: Env): Promise<Response> {
│ ^
╵ )
✘ [ERROR] Expected ")" but found ":"
src/index.js:4:23:
4 │ async fetch(request: Request, env: Env): Promise<Response> {
│ ^
╵ )
So before I try anything wanted to see if it worked for your or someone else.Walshy | Pages
05/24/2023, 10:29 PMWalshy | Pages
05/24/2023, 10:29 PMsilentdevnull
05/24/2023, 10:37 PMsilentdevnull
05/24/2023, 10:38 PMCannot read properties of undefined (reading 'fetch')
Walshy | Pages
05/24/2023, 10:42 PMsilentdevnull
05/24/2023, 10:51 PMimport puppeteer from "@cloudflare/puppeteer";
export default {
async fetch(request: Request, env: Env): Promise<Response> {
const browser = await puppeteer.launch(env.MYBROWSER);
const page = await browser.newPage();
await page.goto("https://example.com");
const metrics = await page.metrics();
await browser.close();
return new Response(JSON.stringify(metrics));
},
};
Chaika
05/24/2023, 10:54 PMChaika
05/24/2023, 10:55 PMname = "browser-worker"
main = "src/index.ts"
compatibility_date = "2023-03-14"
node_compat = true
workers_dev = true
browser = { binding = "MYBROWSER", type = "browser" }
Make sure you're not trying to test locally as well. If you're on the latest wrangler/wrangler@3, use npx wrangler dev --remote
Walshy | Pages
05/24/2023, 11:09 PMsilentdevnull
05/24/2023, 11:25 PM⛅️ wrangler 2.19.0 (update available 3.0.1)
------------------------------------------------------
▲ [WARNING] Processing wrangler.toml configuration:
- Unexpected fields found in top-level field: "browser"
▲ [WARNING] Enabling Node.js compatibility mode for built-ins and globals. This is experimental and has serious tradeoffs. Please see https://github.com/ionic-team/rollup-plugin-node-polyfills/ for more details.
Error when I publish it is 1101.
I haven't moved to version 3 of wrangler as the command changed so I need to have a minute to figure it outWalshy | Pages
05/24/2023, 11:26 PMWalshy | Pages
05/24/2023, 11:27 PMtoml
[[unsafe.bindings]]
binding = "MYBROWSER"
type = "browser"
silentdevnull
05/24/2023, 11:37 PMsilentdevnull
05/25/2023, 12:09 AM柴柴
05/25/2023, 6:26 AM柴柴
05/25/2023, 6:28 AMwrangler.toml
but it won't work either柴柴
05/25/2023, 6:33 AMts
export default <ExportedHandler<Env>> {
async fetch(req, env, ctx) {
...
},
async tail(events, env) {
for (const event of events) {
if (!(event.event as TraceItemFetchEventInfo).request) continue;
await env.BUCKET.put(
'',
JSON.stringify(event),
{ httpMetadata: { contentType: 'application/json' } }
);
}
},
async scheduled(event, env, ctx) {
...
}
};
Neiki
05/25/2023, 7:20 AMNeiki
05/25/2023, 7:32 AM