workers-sdk: πŸ› BUG: 'wrangler@2 pages publish' returns 504 or 503 failure

What version of Wrangler are you using?

2

What operating system are you using?

ubuntu-latest

Describe the Bug

RUNS

GITHUB-ACTION: cloudflare/pages-action@v1.0.0

Run cloudflare/pages-action@v1.0.0
  with:
    apiToken: ***
    accountId: ***
    projectName: xxx-yyy-gitaction
    directory: ./public
    gitHubToken: ***
npm WARN exec The following package was not found and will be installed: wrangler@[2](...)

wrangler COMMAND inside of cloudflare/pages-action@v1.0.0

Executing: npx wrangler@2 pages publish "./public" --project-name="xxx-yyy-gitaction" in /home/runner/work/xxx-yyy/xxx-yyy

ERROR LOG

504

🌎  Uploading... (701/708)

✘ [ERROR] ✘ [ERROR] Received a malformed response from the API


🌎  Uploading... (701/708)
  

    <!DOCTYPE html>
    <!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
    <!--[if I... (length = 7018)
  
    POST /accounts/***/pages/projects/xxx-yyy-gitaction/file -> 504 Gateway Time-out
    
    If you think this is a bug, please open an issue at: https://github.com/cloudflare/wrangler2/issues/new
  
  


npm notice 
npm notice New minor version of npm available! 8.5.5 -> 8.9.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.9.0>
npm notice Run `npm install -g npm@8.9.0` to update!
npm notice 
EXIT WHEN NOT EXPECTED

SHELLAC COMMAND FAILED!
Executing: npx wrangler@2 pages publish "./public" --project-name="xxx-yyy-gitaction" in /home/runner/work/xxx-yyy/xxx-yyy

fetch ERROR


If you think this is a bug then please create an issue at https://github.com/cloudflare/wrangler2/issues/new.
🌏  Uploading... (706/709)



STDERR:

npm WARN exec The following package was not found and will be installed: wrangler@2
npm WARN deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
✘ [ERROR] fetch failed


npm notice 
npm notice New minor version of npm available! 8.5.5 -> 8.9.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.9.0>
npm notice Run `npm install -g npm@8.9.0` to update!
npm notice 

another error

🌏  Uploading... (696/708)


🌏  Uploading... (696/708)



STDERR:

npm WARN exec The following package was not found and will be installed: wrangler@2
npm WARN deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
✘ [ERROR] ✘ [ERROR] Received a bad response from the API

  
    An unknown error occurred [code: 8000000]
    
    If you think this is a bug, please open an issue at: https://github.com/cloudflare/wrangler2/issues/new

Descriptions:

  • wrangler returns 503, 504, or just β€œ[ERROR] fetch failed”
  • I tried manual upload deployments
    • sometimes success, upload failed tens of files

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Hey folks! Sorry about the difficulties here. We had hoped to move onto a system that let you publish files outside of using our API directly, but we didn’t quite get there in time for the launch. This is pretty much the first thing on our list as fast-follow from this announcement, so please bear with us for a little while as we move things over.

@GregBrimble Unfortunately wrangler 2.0.7 definitely did not fix this issue. I have been using it since the day it came out, and still get the same error more often than not:

🌎 Uploading… (184/184) ✨ Success! Uploaded 184 files (5.52 sec) ✘ [ERROR]✘ [ERROR]Received a bad response from the API An unknown error occurred [code: 8000000] If you think this is a bug, please open an issue at: https://github.com/cloudflare/wrangler2/issues/new

Hey folks! We released 2.0.7 a little while ago which takes a new approach to uploading files for wrangler pages publish. It also adds retry logic, so hopefully things are a lot more reliable for you. I’ll close this issue out, but if you continue to have problems, please do open a new issue.

@martinfojtik can u please check this: https://github.com/cloudflare/wrangler2/issues/1015 and confirm if this is same as your case.

Same here, it sometimes succeeds.