Skip to content

Commit 967af52

Browse files
committed
Fix wrangler auth token parsing in cache purge
Use --json flag to avoid capturing the wrangler banner in the auth token, which caused cache purge requests to fail with an invalid header error.
1 parent 8b7d6de commit 967af52

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

packages/deploy/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ function sanitizeBranchName(branch: string): string {
449449
* Purge Cloudflare edge cache for a specific subdomain
450450
*/
451451
async function purgeSubdomainCache(subdomain: string): Promise<void> {
452-
const token = (await wrangler("auth", "token").text()).trim();
452+
const { token } = await wrangler("auth", "token", "--json").json();
453453
const response = await fetch(
454454
`https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/purge_cache`,
455455
{

packages/deploy/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@just-be/deploy",
3-
"version": "0.12.1",
3+
"version": "0.12.2",
44
"description": "Deploy static sites to Cloudflare R2 with subdomain routing",
55
"keywords": [
66
"cloudflare",

0 commit comments

Comments
 (0)