Skip to content

413 Request Entity Too Large; 25 MB file upload #2844

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

Closed
lewellyn opened this issue Oct 7, 2016 · 4 comments
Closed

413 Request Entity Too Large; 25 MB file upload #2844

lewellyn opened this issue Oct 7, 2016 · 4 comments

Comments

@lewellyn
Copy link

lewellyn commented Oct 7, 2016

Issue Description

Using Parse Server 2.2.22, which should have the fix for #536 landed, we are unable to upload large files.

Steps to reproduce

$ ls -l bigfile.bin
-rw-rw-r--. 1 luser luser 26214400 Oct  7 12:17 bigfile.bin
$ curl -X POST -i -H "X-Parse-Application-Id: APPID" -H "X-Parse-Master-Key: MASTERKEY" -H "Content-Type: text/plain" -T "bigfile.bin" http://localhost:1337/APPID/files/bigfile.bin

Expected Results

Successful upload, with a 200 response.

Actual Outcome

HTTP/1.1 100 Continue

HTTP/1.1 413 Payload Too Large
X-Powered-By: Express
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET,PUT,POST,DELETE,OPTIONS
Access-Control-Allow-Headers: X-Parse-Master-Key, X-Parse-REST-API-Key, X-Parse-Javascript-Key, X-Parse-Application-Id, X-Parse-Client-Version, X-Parse-Session-Token, X-Requested-With, X-Parse-Revocable-Session, Content-Type
Content-Type: application/json; charset=utf-8
Content-Length: 36
ETag: W/"24-JVsPySlIr0WkgH5WVJ7mog"
Date: Fri, 07 Oct 2016 19:43:25 GMT
Connection: keep-alive

{"error":"request entity too large"}

Environment Setup

  • Server
    • parse-server version (Be specific! Don't say 'latest'.) : 2.2.22
    • Operating System: RHEL 7.2
    • Hardware: VMware vSphere 6 guest using latest hardware level for RHEL 7
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): Local vSphere cluster
  • Database
    • MongoDB version: Percona 3.2.9
    • Storage engine: rocksdb
    • Hardware: VMware vSphere 6 guest using latest hardware level for RHEL 7
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): Local vSphere cluster

Logs/Trace

263|parse- | Error: request entity too large
263|parse- |     at readStream (/usr/lib/node_modules/parse-server/node_modules/raw-body/index.js:196:17)
263|parse- |     at getRawBody (/usr/lib/node_modules/parse-server/node_modules/raw-body/index.js:106:12)
263|parse- |     at read (/usr/lib/node_modules/parse-server/node_modules/body-parser/lib/read.js:76:3)
263|parse- |     at rawParser (/usr/lib/node_modules/parse-server/node_modules/body-parser/lib/types/raw.js:81:5)
263|parse- |     at Layer.handle [as handle_request] (/usr/lib/node_modules/parse-server/node_modules/express/lib/router/layer.js:95:5)
263|parse- |     at next (/usr/lib/node_modules/parse-server/node_modules/express/lib/router/route.js:131:13)
263|parse- |     at allowCrossDomain (/usr/lib/node_modules/parse-server/lib/middlewares.js:247:5)
263|parse- |     at Layer.handle [as handle_request] (/usr/lib/node_modules/parse-server/node_modules/express/lib/router/layer.js:95:5)
263|parse- |     at next (/usr/lib/node_modules/parse-server/node_modules/express/lib/router/route.js:131:13)
263|parse- |     at Route.dispatch (/usr/lib/node_modules/parse-server/node_modules/express/lib/router/route.js:112:3)
@lewellyn
Copy link
Author

lewellyn commented Oct 7, 2016

Of course, after submitting, I re-read the commit for #604 again. The docs state: "Max file size for uploads. Defaults to 20 MB." so I used 100 MB for the option to maxUploadSize. Changing it to 100mb allowed the upload to work. I expect I had missed a log message somewhere regarding that... Sigh.

Not closing it because it feels like there's some sort of bug here, even if it's just the docs needing to be slightly clearer.

@flovilmart
Copy link
Contributor

@lewellyn yep the error is not clear... but it's slightly more secure than saying, that's too big, max file size is 20mb.

If you feel this should be reported with the size, please open on the raw-body middleware repo:

https://github.com/stream-utils/raw-body

Thanks!

@majidhassan
Copy link

majidhassan commented May 27, 2017

I'm getting this same error uploading a 1.8 MB file while having (the default) 20 MB file size limit. Any ideas, why I'm getting this?

FYI: Using Parse-Server 2.3.7 on DigitalOcean 14.04, with S3 Bucket and mLab hosted DB.

@majidhassan
Copy link

My bad, it turned out it was the NGINX upload limit, which was defaulting to 1mb.

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