Workers Build: API token does not work

Hi, I am trying to deploy my Nuxt app to cloudafare workers but the problem is that I followed the setup on the website, everything builds fine just for the last step when it tries to deploy it throws this error
15:18:11.308
15:18:11.362 ✘ [ERROR] A request to the Cloudflare API (/accounts/.../pages/projects/...) failed.
15:18:11.362
15:18:11.362 Authentication error [code: 10000]
15:18:11.363
15:18:11.363
15:18:11.363 📎 It looks like you are authenticating Wrangler via a custom API token set in an environment variable.
15:18:11.363 Please ensure it has the correct permissions for this operation.
15:18:11.308
15:18:11.362 ✘ [ERROR] A request to the Cloudflare API (/accounts/.../pages/projects/...) failed.
15:18:11.362
15:18:11.362 Authentication error [code: 10000]
15:18:11.363
15:18:11.363
15:18:11.363 📎 It looks like you are authenticating Wrangler via a custom API token set in an environment variable.
15:18:11.363 Please ensure it has the correct permissions for this operation.
I can only generate a new token but cant specify the permissions(reffering to the option in the build category in the setting on the cloudfare dashboard. Is there some way to fix this? Thanks!
10 Replies
Walshy
Walshy3mo ago
Looks like you're trying to deploy to Pages? is this a Worker or Pages project?
MrTinEU
MrTinEUOP3mo ago
worker
Walshy
Walshy3mo ago
Then you'll want your deploy command to be npx wrangler deploy not npx wrangler pages deploy
MrTinEU
MrTinEUOP3mo ago
hmm thats wierd because when i was creating it it was a worker now it gave a error that it is a pages so it is a worker( I used the filter in the Workers & Pages menu) but the wrangler deploy does not work only wrangler pages deploy and the pages command throws the auth error
Walshy
Walshy3mo ago
What's the error for wrangler deploy? Sounds like you may have Pages code but made a Worker project, you can just use a Pages project instead - if you make a new app, pick Pages and select your repo or run npx wrangler pages deploy locally and make new project
MrTinEU
MrTinEUOP3mo ago
sing redirected Wrangler configuration.
16:37:06.474 - Configuration being used: "dist/_worker.js/wrangler.json"
16:37:06.474 - Original user's configuration: "<no user config found>"
16:37:06.474 - Deploy configuration file: ".wrangler/deploy/config.json"
16:37:06.478
16:37:06.527 ✘ [ERROR] It looks like you've run a Workers-specific command in a Pages project.
16:37:06.527
16:37:06.527 For Pages, please run `wrangler pages deploy` instead.
sing redirected Wrangler configuration.
16:37:06.474 - Configuration being used: "dist/_worker.js/wrangler.json"
16:37:06.474 - Original user's configuration: "<no user config found>"
16:37:06.474 - Deploy configuration file: ".wrangler/deploy/config.json"
16:37:06.478
16:37:06.527 ✘ [ERROR] It looks like you've run a Workers-specific command in a Pages project.
16:37:06.527
16:37:06.527 For Pages, please run `wrangler pages deploy` instead.
I will try that I selected workers because of this popup
We recommend using
Cloudflare Workers
for new projects. See how Workers compares to Pages in our
compatibility matrix
.
We recommend using
Cloudflare Workers
for new projects. See how Workers compares to Pages in our
compatibility matrix
.
Walshy
Walshy3mo ago
Yep, Workers is the recommended way to build new apps but if you're using Pages stuff you can still use Pages. You can also move it to Workers but that's not a requirement
MrTinEU
MrTinEUOP3mo ago
So you are saying to use pages for now? for this case
Walshy
Walshy3mo ago
Yeah, that seems like the easiest path forward
MrTinEU
MrTinEUOP3mo ago
thanks that worked flawelessly

Did you find this page helpful?