Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Setting the POST size limit in sails 0.10.5 #2653
Comments
MBrouns
commented
Feb 16, 2015
|
Could you post how you set up your http.js? |
sheoak
commented
Feb 16, 2015
|
Sure. With this version the API doesn’t get the POST data anymore in blueprints. I tried skipper too. I’m not sure I understand properly the role of bodyParser yet.
|
sheoak
commented
Feb 16, 2015
|
I also tried with a limit like 1000000000 |
MBrouns
commented
Feb 16, 2015
|
Could you try incorporating
as mentioned in balderdashy/skipper#22 |
sheoak
commented
Feb 16, 2015
|
I tried that too (I tried again). The API returns no response and the page keeps loading until I get a 502 error (no data received). I got no error from the API. |
sheoak
commented
Feb 16, 2015
|
Ah! But I tried the version that outputs an error and it works:
I just need to get rid of the error now… I wonder why your version doesn’t work, it’s supposed to be the fix. |
sheoak
commented
Feb 16, 2015
|
After looking at the code in https://github.com/balderdashy/sails/blob/master/lib/hooks/http/middleware/defaults.js I think it might be a bug. The syntax I was using is what is suggested in the error message, yet it seems to break the bodyParser. I will make some test about that tomorrow. Thanks for your help @MBrouns! |
|
I just read through this and am trying to understand what goes where for this? |
|
is that limit in bits or bytes? |
sheoak
commented
Mar 2, 2015
|
@jdcauley I’m not sure I understood your question. This is in config/http.js, under middleware key. Not sure it’s in bytes or bits but right now I don’t really care, it just doesn’t work properly (getting an error in sails log, but the limit does work) |
johnferro
commented
May 19, 2015
|
@sheoak Not sure if you're still working on this, but I came across it and figured I'd respond because I was getting similar issues to you. You mentioned a timeout error/no response when using this code from balderdashy/skipper#22:
I think this problem might have come around because you were putting this under the middleware key of http when it should be directly under http (so it would be http.bodyParser instead of http.middleware.bodyParser). When putting it there I was able to get skipper to increase its limit without the timeout issue you mentioned, and with no error message being logged |
sheoak
commented
May 19, 2015
|
I am not working on it anymore and have no access to a computer at the moment. I remember trying that option but sails updates may have change something, or I did it wrong. I will notify the person in charge now! |
jdcauley
closed this
May 20, 2015
hybrisCole
commented
May 22, 2015
|
@johnferro yo forgot to add () at the end of bodyParser's IIFE ;), thx for the snippet amigo |
johnferro
commented
May 22, 2015
|
@hybrisCole Actually I get an error when lifting sails if I try to call it like that, but the extra parentheses I had wrapping the function are unnecessary.
|
hybrisCole
commented
May 22, 2015
|
@johnferro Here's the snippet that's working for me in case you need it, I'm using 0.11.0 not sure if that changes somethig
|
golojads
commented
Jun 12, 2015
|
@hybrisCole can you please post your whole http.js file ? |
hybrisCole
commented
Jun 12, 2015
|
@golojads At the end I decided to come up with a nginx based solution. I'm reverse proxing my sails and handling that limit on nginx instead |
hybrisCole
commented
Jun 15, 2015
|
Lol @golojads I actually have it here, I confused the projects I guess /**
var lusca = require('lusca'); module.exports.http = { /****************************************************************************
} |
nickewansmith
commented
Aug 6, 2015
|
This still is not working properly... +1 |
nickewansmith
commented
Aug 6, 2015
|
Update, this is what worked for my situation
|
sheoak commentedFeb 13, 2015
I can’t find how to configure the POST size limit in sails 0.10.5.
When I post to a simple blueprint url like /mymodel with a lot of data, I get this, due to the default limit:
I tried configuring bodyParser in http.js but none of the methods I found seems to work. The error message just disappear and blueprint don’t see the data anymore.
I’m not sure if it’s a bug or if I’m just doing it wrong. Any idea?