TryGhost / action-deploy-theme

:octocat: Deploy your Ghost theme with Github Actions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: Request body larger than maxBodyLength limit

kaveet opened this issue · comments

Hello!

I'm seeing this issue when uploading a ~150MB theme file. I've confirmed that I'm running @tryghost/admin-api@1.12.0, which has the patch to increase the axios maxBodyLength config option to Infinity (patch here). My Nginx server is configured for a max length of 500MB.

Any ideas?

Run TryGhost/action-deploy-theme@v1.5.0
  with:
    api-url: ***
    api-key: ***
    theme-name: ***
    file: ./theme.zip
Error [ERR_FR_MAX_BODY_LENGTH_EXCEEDED]: Request body larger than maxBodyLength limit
    at RedirectableRequest.module.exports.549.RedirectableRequest.write (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.5.0/dist/index.js:10098:24)
    at FormData.ondata (internal/streams/legacy.js:19:31)
    at FormData.emit (events.js:314:20)
    at FormData.module.exports.547.CombinedStream.write (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.5.0/dist/index.js:9919:8)
    at DelayedStream.ondata (internal/streams/legacy.js:19:31)
    at DelayedStream.emit (events.js:314:20)
    at DelayedStream.module.exports.152.DelayedStream._handleEmit (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.5.0/dist/index.js:3315:15)
    at ReadStream.source.emit (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.5.0/dist/index.js:3262:19)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:272:9) {
  isAxiosError: true,
  toJSON: [Function: toJSON]
}

Update: I've found that the Infinity value in the patch above has no effect.

Here's a change I made in a fork to combat this issue (works like a dream!): main...kaveet:main

I'll work on getting this into upstream (in admin-api).

@kaveet I tried your solution, but unfortunately I'm still getting the same error.
I tried to increase the number, create a release each time I update something and point to the newly added version on the github workflows deploy.
I unfortunately can't seem to make the error dissapear.

  adding: assets/built/phaser.min.js (deflated 73%)
Error [ERR_FR_MAX_BODY_LENGTH_EXCEEDED]: Request body larger than maxBodyLength limit
    at RedirectableRequest.module.exports.549.RedirectableRequest.write (/home/runner/work/_actions/kenjibailly/ghost-action-deploy-theme/v1.5.1/dist/index.js:10098:24)
    at FormData.ondata (internal/streams/legacy.js:19:31)
    at FormData.emit (events.js:314:20)
    at FormData.module.exports.547.CombinedStream.write (/home/runner/work/_actions/kenjibailly/ghost-action-deploy-theme/v1.5.1/dist/index.js:9919:8)
    at DelayedStream.ondata (internal/streams/legacy.js:19:31)
    at DelayedStream.emit (events.js:314:20)
    at DelayedStream.module.exports.152.DelayedStream._handleEmit (/home/runner/work/_actions/kenjibailly/ghost-action-deploy-theme/v1.5.1/dist/index.js:3315:15)
    at ReadStream.source.emit (/home/runner/work/_actions/kenjibailly/ghost-action-deploy-theme/v1.5.1/dist/index.js:3262:19)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:272:9) {
  isAxiosError: true,
  toJSON: [Function: toJSON]
}

When I use "yarn zip" to create a zip of my theme, the size of it is 182 MB, when extracted it's 283MB.
This isn't reaching 500MB by far, so I'm guessing there's another problem?
I'm not familiar with the structure, so I have no idea how to fix it.

Edit:
Might this error also come from this?
https://forum.ghost.org/t/ghost-import-fail-import-failed-request-is-larger-than-the-maximum-file-size-the-server-allows/11839/8

I have the free cloudflare cdn

I think this repo needed a release. Please can you try updating your version in the workflow file to 1.6.0 and let me know if that works?

If it doesn't I will reopen.