Problem with wrangler authentication

For Workers & Pages, what is the name of the domain?

lingbox.dev

What is the error number?

10000

What is the error message?

A request to the Cloudflare API (/accounts/xxxx/pages/projects/xxxxx) failed.

What is the issue or error you’re encountering

Cannot authenticate / deploy

What steps have you taken to resolve the issue?

  • Checked “user read” permission
  • Created a new token
  • Added CLOUDFLARE_API_TOKEN in ~/.wrangler/config/default.toml
  • Added CLOUDFLARE_API_TOKEN in ./wrangler.toml
  • Logout wrangler and login again (without success)

What are the steps to reproduce the issue?

I used to run wangler pages deploy regularly without much problem. But this morining I cannot deploy successfully. The error message was:

Using “CF_API_TOKEN” environment variable. This is deprecated. Please use “CLOUDFLARE_API_TOKEN”, instead.

✘ [ERROR] A request to the Cloudflare API (/accounts/xxxx/pages/projects/xxxx) failed.

Authentication error [code: 10000]

:paperclip: It looks like you are authenticating Wrangler via a custom API token set in an environment variable.
Please ensure it has the correct permissions for this operation.

Getting User settings…
:information_source: The API Token is read from the CLOUDFLARE_API_TOKEN in your environment.
:wave: You are logged in with an API Token. Unable to retrieve email for this user. Are you missing the User->User Details->Read permission?

:unlock: To see token permissions visit https://dash.cloudflare.com/profile/api-tokens.
<<<<<<<<<<<<<<

Has anyone run into similar issues?

Are you still encountering this?

Hi there, I tried again and it works now.

When deploying, wrangler took me to an oath page but it wasn’t redirecting properly.

Then, after doing npx wangler login, I was through.

I was added to a new team recently, not sure whether it causes the issue.

Unfortunately, the same issue happens again after a system restart.

It’s also not possible to do npx wrangler logout. Here’s the message:

You are logged in with an API Token. Unset the CLOUDFLARE_API_TOKEN in the environment to log out.

Where is CLOUDFLARE_API_TOKEN set? I looked at ~/.wrangler/config, my project’s wrangler.toml, and the projects secrets on the web interface, but could not find this key. I am unsure what this message is referring to.

I had this same error but it turned out that I had the CLOUDFLARE_API_TOKEN defined in a .env file which automatically gets picked up as defined here: System environment variables · Cloudflare Workers docs