Workers: Get location/colo on ScheduledEvent

Hi! I’ve just deployed my first worker and it’s great.

I used request.cf.colo to get the location on the Request event. Can I get the same thing using a ScheduledEvent. I’m interested to know where my worker runs, because I want to measure latency on a fetch() request.

Can it be done?
Thanks!

There is a workaround for now:

const req = await fetch("https://example.com");
const colo = req.headers.get("cf-ray").split('-')[1];

Thanks! I’ll give it a go.

I wonder if there’s any way to schedule the runs on a specific colo or geo region? It would be nice to have them run close to home.

Cron Triggers are designed to run in under-utilised locations, which is determined internally by Cloudflare. It is not possible currently to choose which Colo they will run in.