Unable to Authenticate request with 10001 error code

In workers for platform I can't delete my worker anymore. The same code stopped working 😦 I double checked the api key, account Id, email, verified the token. same for rest or js sdk. I'm wondering if the permission have changed or something similar. Please help
9 Replies
Walshy
Walshy•2w ago
10001 in workers doesn't mean auth issue, it means content-type issue 1000 iirc is auth issue which are you actually getting? and what does the response say?
TurboJack
TurboJackOP•2w ago
{"code":10001,"message":"Unable to authenticate request"}
{"code":10001,"message":"Unable to authenticate request"}
I'm currently try other apis endpoints too. All return the same error. example
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/workers/dispatch/namespaces/$DISPATCH_NAMESPACE/scripts/$SCRIPT_NAME \
-X DELETE \
-H "X-Auth-Email: $CLOUDFLARE_EMAIL" \
-H "X-Auth-Key: $CLOUDFLARE_API_KEY"
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/workers/dispatch/namespaces/$DISPATCH_NAMESPACE/scripts/$SCRIPT_NAME \
-X DELETE \
-H "X-Auth-Email: $CLOUDFLARE_EMAIL" \
-H "X-Auth-Key: $CLOUDFLARE_API_KEY"
or
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/workers/scripts \
-H "X-Auth-Email: $CLOUDFLARE_EMAIL" \
-H "X-Auth-Key: $CLOUDFLARE_API_KEY"
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/workers/scripts \
-H "X-Auth-Email: $CLOUDFLARE_EMAIL" \
-H "X-Auth-Key: $CLOUDFLARE_API_KEY"
TurboJack
TurboJackOP•2w ago
No description
Walshy
Walshy•2w ago
the key is invalid it looks like that's for api tokens, did you pass an api token in the key header? if you're using an api token, you need to use Authorization: Bearer $API_TOKEN
TurboJack
TurboJackOP•2w ago
I'll try I got it working but this is definitely a breaking change. My old code which stopped working looks like this.
const client = new Cloudflare({ apiKey: this.env.CLOUDFLARE_API_KEY, apiEmail: this.env.CLOUDFLARE_EMAIL })
await client.workersForPlatforms.dispatch.namespaces.scripts.delete(
args.dispatchedNamespace,
args.scriptName,
{ account_id: args.cloudflareAccountId, force: true }
)
const client = new Cloudflare({ apiKey: this.env.CLOUDFLARE_API_KEY, apiEmail: this.env.CLOUDFLARE_EMAIL })
await client.workersForPlatforms.dispatch.namespaces.scripts.delete(
args.dispatchedNamespace,
args.scriptName,
{ account_id: args.cloudflareAccountId, force: true }
)
no matter what combination of new Cloudflare, with apiKey, or apiToken, with or without email returns the same 10001 error. But using curl I got it working with this
curl https://api.cloudflare.com/client/v4/accounts/<MY_ACCOUNT_ID>/workers/dispatch/namespaces/dev/scripts/<SCRIPT> \
-X DELETE \
-H "Authorization: Bearer <MY_TOKEN>"

{
"result": {
"id": "..."
},
"success": true,
"errors": [],
"messages": []
}
curl https://api.cloudflare.com/client/v4/accounts/<MY_ACCOUNT_ID>/workers/dispatch/namespaces/dev/scripts/<SCRIPT> \
-X DELETE \
-H "Authorization: Bearer <MY_TOKEN>"

{
"result": {
"id": "..."
},
"success": true,
"errors": [],
"messages": []
}
Walshy
Walshy•2w ago
did you update the sdk? if so, i'd suggest trying the older version if not, then you must be passing in different values.
TurboJack
TurboJackOP•2w ago
I only updated
"wrangler": "^4.10.0"
"wrangler": "^4.10.0"
vars are in my .dev.var file. I really don't know. The cloudflare sdk has not changed since a month. let me try to reverse wrangler (should be unrelated) I found the cause. Yesterday updated my wrangler.json from
"compatibility_date": "2025-03-31",
"compatibility_date": "2025-03-31",
to
"compatibility_date": "2025-04-11",
"compatibility_date": "2025-04-11",
I double checked. Ran both version. Is this the expected behaviour?
Walshy
Walshy•2w ago
Compatibility date will not change API behaviour Where is wrangler.json even coming into this? Are you running this as part of a worker?
TurboJack
TurboJackOP•7d ago
Yes the code runs locally using wrangler dev and within the worker I call the cloudflare api to delete via worker for platforms.

Did you find this page helpful?