First time using workers (cron trigger), CANNOT get it to work for me.

I've followed the instructions, it's showing up on the panel, I'm just not getting anything back
No description
9 Replies
Gizmo
Gizmo7mo ago
No description
Gizmo
Gizmo7mo ago
Got nothing here
No description
Gizmo
Gizmo7mo ago
Every time I try to hit the log stream button it times out on me, not sure if that's indicative of something that I did wrong or something going wrong on cloudflare's end
No description
Gizmo
Gizmo7mo ago
export default {
// The scheduled handler is invoked at the interval set in our wrangler.toml's
// [[triggers]] configuration.
async scheduled(event, env, ctx) {
// A Cron Trigger can make requests to other endpoints on the Internet,
// publish to a Queue, query a D1 Database, and much more.
//
// We'll keep it simple and make an API call to a Cloudflare API:
let resp = await fetch('https://api.cloudflare.com/client/v4/ips');
let wasSuccessful = resp.ok ? 'success' : 'fail';

// You could store this result in KV, write to a D1 Database, or publish to a Queue.
// In this template, we'll just log the result:
console.log(`trigger fired at ${event.cron}: ${wasSuccessful}`);
},
};
export default {
// The scheduled handler is invoked at the interval set in our wrangler.toml's
// [[triggers]] configuration.
async scheduled(event, env, ctx) {
// A Cron Trigger can make requests to other endpoints on the Internet,
// publish to a Queue, query a D1 Database, and much more.
//
// We'll keep it simple and make an API call to a Cloudflare API:
let resp = await fetch('https://api.cloudflare.com/client/v4/ips');
let wasSuccessful = resp.ok ? 'success' : 'fail';

// You could store this result in KV, write to a D1 Database, or publish to a Queue.
// In this template, we'll just log the result:
console.log(`trigger fired at ${event.cron}: ${wasSuccessful}`);
},
};
Not sure if it's relevant, but I'm running the cron job template code
Chaika
Chaika7mo ago
Cron normally can be delayed up to 15 minutes when you deploy a new pattern, but also those cron analytics are just completely broken right now, so it might be firing not a good time to get started with your first worker sorry lol, might want to just wait until after that incident is over.
Gizmo
Gizmo7mo ago
It deleted my message because I said a bad word. Thanks for the information, I’m just glad there’s a chance it’s not my fault lol
Chaika
Chaika7mo ago
You could try local dev in the meantime, or just wait it out
Gizmo
Gizmo7mo ago
Apparently it was in fact working, just not showing logs Thanks for your help!
Want results from more Discord servers?
Add your server