cloudflare / workers-sdk

⛅️ Home to Wrangler, the CLI for Cloudflare Workers®
https://developers.cloudflare.com/workers/
Apache License 2.0
2.75k stars 736 forks source link

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

Open aswinkp opened 1 year ago

aswinkp commented 1 year ago

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
jahands commented 1 year ago

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)

jakubadamw commented 1 year ago

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.

alexanderglueck commented 1 year ago

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.

hellt commented 1 year ago

Started to see this today as well.

thdoan commented 1 year ago

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
jakubadamw commented 1 year ago

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.