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

Created on 8 Sep 2016  路  17Comments  路  Source: parse-community/parse-server

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"

Most helpful comment

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;

All 17 comments

@flovilmart please look into above.

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;

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

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

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

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

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

did you rebuild your environment?

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

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

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

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

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 :(

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!

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 what is conf.d and parseserver.conf? I ran into this issue again after I thought it was resolved about 2 years ago...

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

@mtrezza yea I just figured it out. Turns out you can actually modify the nginx file as well. Just set it under the server config:

  server {
      listen        80 default_server;
      maxUploadSize: '30mb';

   ... 
  }
Was this page helpful?
0 / 5 - 0 ratings