Error when uploading worker script via API

Hello, been trying to upload a worker module via the Cloudflare API, but I'm running into the following error message:
{
"code": 10021,
"message": "Uncaught TypeError: Main module name is not present in bundle.\n"
}
{
"code": 10021,
"message": "Uncaught TypeError: Main module name is not present in bundle.\n"
}
I've tried testing with the exact code from the API docs (https://developers.cloudflare.com/api/operations/worker-script-put-content) via javascript and curl, but both generate the same issue. I can upload workers in service worker format fine.
Cloudflare API Documentation
Interact with Cloudflare's products and services via the Cloudflare API
1 Reply
Erisa
Erisa5mo ago
Could you share the code or a minimal reproducible example of code that fails?