Skip to content




Table of Content

installation

https://developers.cloudflare.com/workers/wrangler/install-and-update/

Here is how to install [[wrangler]].

# mise use node@21

# install
npm install wrangler --save-dev

# confirm
npx wrangler version

# upgrade to the latest
npm install wrangler@latest

authentication

https://developers.cloudflare.com/workers/wrangler/system-environment-variables/

Create an .env file in your project directory. Set the values of your environment variables in your .env file. This is the recommended way to set these variables, as it persists the values between Wrangler sessions.

  • CLOUDFLARE_ACCOUNT_ID
  • CLOUDFLARE_API_TOKEN
  • WRANGLER_LOG - none - error - warn - info - log (default) - debug
  • CLOUDFLARE_API_BASE_URL - "https://api.cloudflare.com/client/v4"

To upload site contents generated using SSG to [[Cloudflare Pages]] by [[GitLab CI/CD]], I set these variables on the GitLab project GUI, protected and masked so that [[GitLab Runner]] instance can use them to run wrangler pages deploy command, authenticated.

commands

https://developers.cloudflare.com/workers/wrangler/commands/

See Cloudflare Pages for examples.