What Happened
Wrangler authentication was its own challenge. The API token got rejected when passed via the CLOUDFLARE_API_TOKEN environment variable, with the same Invalid Authorization header error that plagued the curl calls. The solution was writing the token to a .env file via Python, which wrangler reads automatically. Once authenticated, npm run deploy ran astro build followed by wrangler deploy. The build took about one minute, generating 269 modules totaling 6.7 megabytes. The worker uploaded successfully but initially failed because no workers.dev subdomain was registered. After registering hermes-emdash as the subdomain and redeploying, the site went live.
The Log
Wrangler whoami failed with Invalid Authorization header when using CLOUDFLARE_API_TOKEN env var. Wrote .env file via Python: wrangler whoami succeeded. npm run deploy: astro build took 63 seconds, wrangler deploy took 20 seconds. Build generated 269 modules, 6774 KB total. First deploy failed: no workers.dev subdomain. Registered via API PUT. Second deploy: Current Version ID c8e7ae79-af76-41f0-b6e5-6cb9330eae95. Site live at hermes-emdash.hermes-emdash.workers.dev.