No event handlers were registered. This script does nothing. [code: 10021]

Processing src/wrangler.json configuration: - Unexpected fields found in top-level field: "crons" Total Upload: 0.69 KiB / gzip: 0.40 KiB Your worker has access to the following bindings: - KV Namespaces: - MY_KV: ---- ✘ [ERROR] A request to the Cloudflare API (/accounts/----/workers/scripts/my-worker) failed. No event handlers were registered. This script does nothing. [code: 10021]. .... any one how to solve this
13 Replies
Hard@Work
Hard@Work2w ago
Are you doing
{
"triggers": {
"crons": [
"* * * * *"
]
}
}
{
"triggers": {
"crons": [
"* * * * *"
]
}
}
Skins
SkinsOP2w ago
, "crons": [ "*/15 * * * *", "0 0 * * *", "0 0 * * MON" ], something this
Hard@Work
Hard@Work2w ago
Yeah, it needs to be listed under triggers
Skins
SkinsOP2w ago
thanks hey still having same. error npx wrangler deploy src/wrangler.json ⛅️ wrangler 3.107.3 -------------------- Total Upload: 0.68 KiB / gzip: 0.40 KiB Your worker has access to the following bindings: - KV Namespaces: - MY_KV: --- ✘ [ERROR] A request to the Cloudflare API (/accounts/---/workers/scripts/my-worker) failed. No event handlers were registered. This script does nothing. [code: 10021]
Hard@Work
Hard@Work2w ago
What does the main file of your Worker look like?
Skins
SkinsOP2w ago
No description
Hard@Work
Hard@Work2w ago
I meant, what does app.js look like? Also, note that the contents of your wrangler.json is safe to be shared(as long as you aren't putting secrets in it). Binding IDs are tied to your account, so unless a user has access to your account, they won't be able to use them for anything
Skins
SkinsOP2w ago
like this
Skins
SkinsOP2w ago
Skins
SkinsOP2w ago
"wrangler.json is safe to be shared" thanks for letting know.
Hard@Work
Hard@Work2w ago
Oh, that's it. You can't use express on Workers
Skins
SkinsOP2w ago
okay any thing else i do for it can i use pages to deploy this project
SuperHelpflare
Cloudflare Pages is for static content (HTML, CSS, JS, images and other such files). It will not run a webserver such as Express, Koa or the likes. If you're using those to serve static content then you can just remove that part and use Pages! If you're doing more dynamic content you can use Functions. It will run code on request (so still not a webserver in the conventional sense). This would allow for more dynamic content though especially with KV (Key/Value storage) and Durable Objects (transactional data storage). Functions are natively integrated with Pages so are super easy to get up and running along your website. Otherwise, a good old VPS or dedicated server from one of the many hosts out there is for you.

Did you find this page helpful?