#Workers Build: API token does not work

16 messages · Page 1 of 1 (latest)

viscid flint
#

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.

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!

slender zenith
#

Looks like you're trying to deploy to Pages? is this a Worker or Pages project?

slender zenith
#

Then you'll want your deploy command to be npx wrangler deploy not npx wrangler pages deploy

viscid flint
viscid flint
#

and the pages command throws the auth error

slender zenith
#

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

viscid flint
# slender zenith What's the error for wrangler deploy?
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.
viscid flint
#

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
.
slender zenith
#

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

viscid flint
#

for this case

slender zenith
#

Yeah, that seems like the easiest path forward