workers-sdk: 🐛 BUG: Authentication error [code: 10000]

Which Cloudflare product(s) does this pertain to?

Wrangler

What version of Wrangler are you using?

2.9.0

What operating system are you using?

Mac

Describe the Bug

Locally and on the buildkite CI/CD, I’m getting the following error:

wrangler publish --env staging   
Delegating to locally-installed wrangler@2.9.0 over global wrangler@2.9.0...
Run `npx wrangler publish --env staging` to use the local version directly.

 ⛅️ wrangler 2.9.0 
-------------------
Your worker has access to the following bindings:
- Vars:
  - ENVIRONMENT: "staging"
  - MRYUM_URL: "staging.mryum.com"
Total Upload: 415.84 KiB / gzip: 65.54 KiB

✘ [ERROR] A request to the Cloudflare API (/accounts/<OBFUSCATED>/workers/scripts/global-staging-qr-proxy) failed.

  Authentication error [code: 10000]
  
  If you think this is a bug, please open an issue at:
  https://github.com/cloudflare/wrangler2/issues/new/choose

I have tried to reset the token. I have tried passing in the CLOUDFLARE_API_TOKEN=<YOUR_API_TOKEN_VALUE> in the command line. I have tried adding permission “Account Workers Scripts Edit” permission to your token.

Nothing seems to be fixing the issue

Screenshot 2023-02-03 at 5 00 18 PM (1) Screenshot 2023-02-03 at 5 00 45 PM (1)

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 6
  • Comments: 23 (8 by maintainers)

Most upvoted comments

Hi @jspspike

Initially we were using CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID, CLOUDFLARE_API_TOKEN is the one that you create manually:

image

But few days ago during CI deployment it just stoped working viat throwing error Authentication error [code: 10000], no changes were done to token permissions, so we switched to CLOUDFLARE_EMAIL and CLOUDFLARE_API_KEY (aka Global API Key)

I ran into this error as well and after hours of debugging discovered that wrangler caches some account settings into the “node_modules/.cache/wrangler/” directory, then it uses those and ignores environment variables!

@agis You shouldn’t have to provide anything else to Github Actions other than setting the CF_API_TOKEN actions secret in your repository settings. I would try testing with wrangler manually and creating a token with all accounts and zones and start restricting permissions to see what permission is causing the issue

How would you pass the CF_API_TOKEN to Wrangler manually? I couldn’t find any instructions in the documentation on how to do this.

I am seeing the same issue “workers.api.error.unauthorized [code: 10023]”. This started happening on a perfectly working github action.