How do I prove to myself that my CF worker is actually being hit?

I am unable to convince myself that my worker is being hit.

Specifically, I did this:

addEventListener("fetch", event => {
 event.respondWith(handleRequest(event.request))
})

async function handleRequest(request) {
throw new Error(“break”)

}

and I cannot get a failure to occur when I hit a matching route.

Where can I see a log of some sort to prove that my worker is or is not being invoked?

return new Response('Hi from your Worker');

should cover that.

$ wrangler tail. You’ll need to have cloudflared installed. More details here

Wrangler is an option but you neither need wrangler nor cloudflared to check if your Worker is running. The above example will quickly show that.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.