workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

🐛 BUG: Wrangler randomly throws "Received a malformed response from the API" when publishing pages

Open aswinkp opened this issue 2 years ago • 6 comments

Which Cloudflare product(s) does this pertain to?

Wrangler

What version of Wrangler are you using?

2.1.13

What operating system are you using?

Linux

Describe the Bug

I often come across this error when running wrangler. Maybe some problem with the API I guess, but there is so consistency that I can find. When I run the same command once again, it executes smoothly without any issues.

Command: CLOUDFLARE_ACCOUNT_ID=XXXX CLOUDFLARE_API_TOKEN=XXXX wrangler pages publish public --commit-dirty=true --project-name=XXXX --branch main

Error:

✘ [ERROR] Received a malformed response from the API <!DOCTYPE html>  <!--[if lt IE 7]> <html class=\"no-js ie6 oldie\" lang=\"en-US\"> <![endif]-->  <!--[if I... (length = 6510)  GET /accounts/XXXX/pages/projects/XXXX/upload-token -> 502 Bad Gateway

aswinkp avatar Feb 24 '23 12:02 aswinkp

I've gotten this error as well. We should add retries to this API call (as well as POST /deployments if it doesn't already)

jahands avatar Apr 03 '23 15:04 jahands

We've been seeing these a lot in our CI. Also, a lot of 504s such as:

POST /zones/{REDACTED}/workers/routes -> 504 Gateway Time-out

Could we have wrangler retry on these errors, please? Could be configurable, if necessary.

jakubadamw avatar Jun 30 '23 11:06 jakubadamw

We are experiencing the same issue on a different route:

GET /accounts/[MASKED]/pages/projects/[project-slug] -> 504 Gateway Time-out

We are using the npx wrangler pages deploy dist --project-name [PROJECT-NAME] --branch staging command to deploy to Cloudflare pages.

alexanderglueck avatar Oct 09 '23 09:10 alexanderglueck

Started to see this today as well.

hellt avatar Oct 09 '23 09:10 hellt

Ditto. Seems like a recent issue because I was deploying a few weeks ago with no issues. I get an error no matter what command I use. Example:

$ wrangler whoami
 ⛅️ wrangler 3.15.0
-------------------
Getting User settings...

✘ [ERROR] Received a malformed response from the API

  <!DOCTYPE html>
  <!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
  <!--[if I... (length = 7178)

  GET /user -> 524

  If you think this is a bug, please open an issue at:
  https://github.com/cloudflare/workers-sdk/issues/new/choose

thdoan avatar Nov 02 '23 18:11 thdoan

Ditto. Seems like a recent issue because I was deploying a few weeks ago with no issues. I get an error no matter what command I use. Example:

$ wrangler whoami
 ⛅️ wrangler 3.15.0
-------------------
Getting User settings...

✘ [ERROR] Received a malformed response from the API

  <!DOCTYPE html>
  <!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
  <!--[if I... (length = 7178)

  GET /user -> 524

  If you think this is a bug, please open an issue at:
  https://github.com/cloudflare/workers-sdk/issues/new/choose

Please note there is an ongoing incident with a downgrade in availability of the Cloudflare API, which might be causing these failures at this particular time.

jakubadamw avatar Nov 02 '23 18:11 jakubadamw