Skip to content

Parse server not uploading file > 1mb, logs in server: "client intended to send too large body" #2671

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
aliasad106 opened this issue Sep 8, 2016 · 15 comments

Comments

@aliasad106
Copy link

I am using aws elasticbeanstalk for my parse-server deployment. When I upload a file from client, the file doesn't get uploaded and it stucks on 3% or 4% based on total size.
On AWS elasicbeanstalk I'm getting below log which seems to be the problem. File size is 1.7mb
client intended to send too large body: 1784523 bytes, client: 172.31.46.180, server: , request: "POST /parse/files/file HTTP/1.1", host: "dev-evn.jvfxpepifx.us-west-2.elasticbeanstalk.com"

@aliasad106
Copy link
Author

@flovilmart please look into above.

@aliasad106 aliasad106 changed the title Parse server not uploading file logs in server "client intended to send too large body" Parse server not uploading file > 1mb, logs in server: "client intended to send too large body" Sep 8, 2016
@aliasad106
Copy link
Author

currently solved this issue by adding a .config file in .ebextensions folder with content below:

files:
  /etc/nginx/conf.d/proxy.conf:
    content: |
      client_max_body_size 50M;

@ryderjack
Copy link

Hey @aliasad106 I'm having same issue. Can you point me to where the .ebextensions folder is? cheers

@aliasad106
Copy link
Author

@ryderjack it's in your parse-server-example folder. on mac CMD+SHIFT+G and enter .ebextensions

@ryderjack
Copy link

@aliasad106 can't see it - happen to know how I can create one? Having issues since it starts with a '.'

@kgoedecke
Copy link

kgoedecke commented Oct 4, 2016

@aliasad106 thanks, made my day! Simply created .ebextensions/files.config as described and problem solved.

@mdimarca
Copy link

mdimarca commented Jan 5, 2017

I created a .ebextensions folder in my parse server and put a files.config file in it with this in the file:
files: /etc/nginx/conf.d/proxy.conf: content: | client_max_body_size 50M;

However, I'm still getting the too large error when trying to upload photos. Do I have to do something else to get it to run? I read that I might need to throw this into the files.config to get it to run:
container_commands: 01_reload_nginx: command: "service nginx reload"

When I upload an update to my server, I select all the files in my parse-server folder, compress them and upload that zip. I don't see the .ebextensions in the zip. I read somewhere else that that AWS EB incorporates the information from .ebextensions when it's uploaded but doesn't need the file itself.

Any idea what's going on here and what I should do? Thanks! @aliasad106 @ryderjack @kgoedecke

@acinader
Copy link
Contributor

acinader commented Jan 5, 2017

did you rebuild your environment?

pretty sure you'll need to do that if you changed your config.

@mdimarca
Copy link

mdimarca commented Jan 5, 2017

What do you mean by rebuild the environment? After I added the changes, I pushed them to my git repo, then zipped the files in my server folder and uploaded them to AWS EB. @acinader

@acinader
Copy link
Contributor

acinader commented Jan 5, 2017

Well, before I send you on a wild goose chase, would be good to verify that what I'm suggesting is actually the problem?

Do you know how to eb ssh to your cluster? If you do, you can look at the nginx config and see if it has your new max size value. I'm guessing that it doesn't.

I do my setup different than you do. If i just update code, then I can use the command line to eb deploy. But if I change the configuration of the cluster (which is what you are doing), then I create a new cluster (aka environment) with eb create, and that new environment will be created with your new changes.....

@mdimarca
Copy link

mdimarca commented Jan 5, 2017

When I change code, I just zip the files and click the "Upload and Deploy" button inside of my application's enviroment. I tried using the eb command line but it was giving me a lot of errors so I switched to the zip format and it's been working well. I'm pretty sure the max file size isn't updating since it's still not working.

I haven't SSHed into AWS before. Is it something I can check in the "logs" or the "configuration" or somewhere else by any chance? I'll look into how to SSH in the meantime.

I see an option to "Rebuild Environment" and "Restart App Server(s)" as you can see here. I'll give that a shot.

screen shot 2017-01-05 at 6 37 50 pm

@acinader

@acinader
Copy link
Contributor

acinader commented Jan 5, 2017

if you've loaded a new config and then rebuild, that might work? with eb, usually takes some trial and error to figure out :) and that's not the way i've done it, so my best suggestion is to play around and find a way where you can verify what the nginx config is.....

sorry i can't help more with your particular setup :(

@mdimarca
Copy link

mdimarca commented Jan 6, 2017

I finally got uploading files up to 50M to work. I unhid the files in the folder for my server using this:
defaults write com.apple.finder AppleShowAllFiles YES killall Finder

Then, I highlighted the files and compressed them and ran the following code on the zip file to remove the _MACOSX folder Mac's auto create for it:
zip -d nomnomzparseserver.zip __MACOSX/\*

However, although I can upload images up to the 50M which I specified in the .config file, I cannot pull down any of the photos anymore...
My iOS app gets this error when trying to pull down the photos:
Error Domain=Parse Code=1 "Response status code was unacceptable: 404" UserInfo={error=Response status code was unacceptable: 404, NSLocalizedDescription=Response status code was unacceptable: 404, code=1}

I then turned directAccess to true in my S3 initialization in my Parse server initialization. That caused the error to be a 403 instead of a 404. I then set a policy on my S3 bucket following this and now it is all working properly.

All good now!

@mtrezza
Copy link
Member

mtrezza commented Feb 21, 2019

Elastic Beanstalk now has native support for appending the nginx configuration.

To extend Elastic Beanstalk's default nginx configuration, add .conf configuration files to a folder named .ebextensions/nginx/conf.d/ in your application source bundle. Elastic Beanstalk's nginx configuration includes .conf files in this folder automatically.

For example, add a file .ebextensions/nginx/conf.d/parseserver.conf with content:

client_max_body_size 50M;

@mtrezza
Copy link
Member

mtrezza commented Feb 23, 2019

@HackShitUp I don’t understand your question. conf.d is a directory, parseserver.conf is a file you add. Did you read the linked doc?

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

7 participants