Wrangler Pages Deployment Slow and Crashing

I have a 1.6GB static site of 2367 files which I’m trying to deploy to Cloudflare Pages. This Pages application uses direct upload instead of a Git repository. wrangler pages deploy is very slow to upload on a decent internet connection and it crashes mid-upload due to an expired JWT.

% npx wrangler pages deploy _site 

🌍  Uploading... (90/2367)

/Users/emily/deploy/bikeblog/node_modules/wrangler/wrangler-dist/cli.js:29374
            throw a;
            ^

FatalError: Failed to upload files. Please try again. Error: {"text":"Received a malformed response from the API","notes":[{"text":"Expired JWT"},{"text":"POST /pages/assets/upload -> 403 Forbidden"}],"kind":"error","name":"ParseError"})
    at /Users/emily/deploy/bikeblog/node_modules/wrangler/wrangler-dist/cli.js:140893:13
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async run (/Users/emily/deploy/bikeblog/node_modules/wrangler/wrangler-dist/cli.js:140417:26) {
  code: 1
}

Node.js v21.5.0

I’m on the latest version:

% npm list --depth=0 | grep wrangler
└── [email protected]

It works fine if I create a directory with a single small file and deploy that. Any suggestions? I might push the production build artifacts to a new Git repository and try that. I was trying to avoid committing build artifacts. Cloudflare Pages can’t build my Eleventy-based site for me because I have too much image processing and a cold build takes ~30 minutes.

1 Like

I have the same issue:

🌏  Uploading... (570/10232)

/Users/mt/www/EBGDAE/node_modules/wrangler/wrangler-dist/cli.js:29374
            throw a;
            ^

FatalError: Failed to upload files. Please try again. Error: {"text":"Received a malformed response from the API","notes":[{"text":"Expired JWT"},{"text":"POST /pages/assets/upload -> 403 Forbidden"}],"kind":"error","name":"ParseError"})
    at /Users/mt/www/EBGDAE/node_modules/wrangler/wrangler-dist/cli.js:140972:13
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async run (/Users/mt/www/EBGDAE/node_modules/wrangler/wrangler-dist/cli.js:140496:26) {
  code: 1
}

Node.js v21.5.0

The version of Wrangler is the latest one