Cannot get worker to trigger with route on site

I've configured a very basic worker to log a message, then call fetch to return an non-mutated response. Testing the worker seems to work fine, but when trying to get it to be invoked through a route on my zone it does nothing. I setup the route like https://mydomain.com/* so it would work on all routes. Used the c3 tool to create and deploy the worker.
2 Replies
Torby
TorbyOP9mo ago
Here's my worker code:
// Export a default object containing event handlers
export default {
// The fetch handler is invoked when this worker receives a HTTP(S) request
// and should return a Response (optionally wrapped in a Promise)
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
console.log('Got a request:', request.url);
return fetch(request);
},
};
// Export a default object containing event handlers
export default {
// The fetch handler is invoked when this worker receives a HTTP(S) request
// and should return a Response (optionally wrapped in a Promise)
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
console.log('Got a request:', request.url);
return fetch(request);
},
};
Chaika
Chaika9mo ago
Is the DNS Record of the hostname you are trying it on, proxied? Is it potentially an old CF partner like Shopify? may be worth mentioning too that log would only be visible if you're tailing the worker, not in browser logs or anything
Want results from more Discord servers?
Add your server