Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Request body larger than maxBodyLength limit #68

Closed
kaveet opened this issue May 16, 2022 · 3 comments
Closed

Error: Request body larger than maxBodyLength limit #68

kaveet opened this issue May 16, 2022 · 3 comments

Comments

@kaveet
Copy link

kaveet commented May 16, 2022

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]
}
@kaveet
Copy link
Author

kaveet commented May 16, 2022

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).

@kenjibailly
Copy link

kenjibailly commented Jun 16, 2022

@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

@ErisDS
Copy link
Member

ErisDS commented Aug 8, 2022

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.

@ErisDS ErisDS closed this as completed Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants