question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't publish to Cloudflare pages using API token.

See original GitHub issue

Hi, The title says about it.

I wanted to deploy my Jekyll website using an automation tool, I created an API token using the Worker template. but it doesn’t seem to work when publishing the page. It works when using wrangler login

Using API token (Edit Cloudflare Worker template):

$ export CLOUDFLARE_API_TOKEN=<insert_api_token_here>
$ wrangler whoami                                        
 ⛅️ wrangler 2.0.7 
-------------------
Getting User settings...
πŸ‘‹ You are logged in with an OAuth Token, associated with the email 'lemniskett@gmail.com'!
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Account Name                   β”‚ Account ID                       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Lemniskett@gmail.com's Account β”‚ <insert_account_id_here>         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

$ wrangler pages publish _site/ --project-name lemniskett

✘ [ERROR] ✘ [ERROR] Received a bad response from the API

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

Using wrangler login:

$ wrangler login                                         
 ⛅️ wrangler 2.0.7 
-------------------
Attempting to login via OAuth...
Successfully logged in.
$ wrangler pages publish _site/ --project-name lemniskett
🌍  Uploading... (23/23)

✨ Success! Uploaded 23 files (5.51 sec)

✨ Deployment complete! Take a peek over at https://some.url.here

My wrangler version:

$ wrangler --version
2.0.7

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
helsuscommented, Jun 8, 2022

@lemniskett Just add Account - Cloudflare Pages - Edit permission

1reaction
threepointonecommented, Jun 5, 2022

This is pages, so it may not be related to the routes issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

REST API Β· Cloudflare Pages docs
After creating your token, you can authenticate and make requests to the API using your API token in the request headers. For example,...
Read more >
BUG: Wrangler publish returning generic error: Authentication ...
@threepointone FWIW, I've run into the exact same issue. The problem was a .env file in the current folder containing a CLOUDFLARE_API_TOKENΒ ...
Read more >
How to publish a Remix app to the edge with GitLab and ...
To be able to deploy your Cloudflare Worker from a GitLab pipeline you will need an API token. To do so, log in...
Read more >
Cloudflare Pages and Workers with Firebase Authentication
If built success, Cloudflare will generate URL for your pages. You can access your pages from this URL. You might need to wait...
Read more >
Building Password Purgatory with Cloudflare Pages and ...
Last month as part of my blog post on How Everything We're Told About ... Cloudflare's API tokens page allows you to create...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found