Skip to content
This repository was archived by the owner on Dec 8, 2017. It is now read-only.

Increase payload limit #14

Open
juliaelman opened this issue Jun 19, 2015 · 4 comments
Open

Increase payload limit #14

juliaelman opened this issue Jun 19, 2015 · 4 comments
Labels

Comments

@juliaelman
Copy link

Recently we merged in a rather large pull request for the pattern library project and was rejected b/c of the size: uswds/uswds#54

@juliaelman juliaelman added the bug label Jun 19, 2015
@mbland
Copy link
Contributor

mbland commented Jun 22, 2015

So here's the stack trace:

Error: request entity too large
    at makeError (/home/ubuntu/node_modules/hookshot/node_modules/body-parser/node_modules/raw-body/index.js:184:15)
    at module.exports (/home/ubuntu/node_modules/hookshot/node_modules/body-parser/node_modules/raw-body/index.js:40:15)
    at read (/home/ubuntu/node_modules/hookshot/node_modules/body-parser/lib/read.js:62:3)
    at jsonParser (/home/ubuntu/node_modules/hookshot/node_modules/body-parser/lib/types/json.js:87:5)
    at Layer.handle [as handle_request] (/home/ubuntu/node_modules/hookshot/node_modules/express/lib/router/layer.js:82:5)
    at trim_prefix (/home/ubuntu/node_modules/hookshot/node_modules/express/lib/router/index.js:270:13)
    at /home/ubuntu/node_modules/hookshot/node_modules/express/lib/router/index.js:237:9
    at Function.proto.process_params (/home/ubuntu/node_modules/hookshot/node_modules/express/lib/router/index.js:312:12)
    at /home/ubuntu/node_modules/hookshot/node_modules/express/lib/router/index.js:228:12
    at Function.match_layer (/home/ubuntu/node_modules/hookshot/node_modules/express/lib/router/index.js:295:3)

I found this in hookshot/node_modules/body-parser/lib/types/json.js:

/**                                                                             
 * Create a middleware to parse JSON bodies.                                    
 *                                                                              
 * @param {object} [options]                                                    
 * @return {function}                                                           
 * @api public                                                                  
 */                                                                             

function json(options) {                                                        
  options = options || {}                                                       

  var limit = typeof options.limit !== 'number'                                 
    ? bytes(options.limit || '100kb')                                           
    : options.limit

And wouldn't you know it, it's hardcoded in hookshot/lib/index.js:

var bodyParser = require('body-parser');                                        
var normalize = require('path').normalize;                                      
var spawn = require('child_process').spawn;
var express = require('express');                                               

module.exports = function (ref, action) {

  // create express instance
  var hookshot = express();

  // middleware
  hookshot.use(bodyParser.urlencoded({ extended: false }));                     
  hookshot.use(bodyParser.json());

Lemme think for a minute how to get around this. I mean, who would ever need to parse a >100KB webhook payload? :-P

mbland pushed a commit to 18F/hookshot that referenced this issue Jun 22, 2015
18F/pages is a Hookshot server for https://pages.18f.gov/. Recently, as noted
in 18F/pages#14, the default 100KB payload limit was exceeded by a webhook
fired for uswds/uswds#54. This change will allow us to pass
options through to the bodyParser.json() middleware to increase the limit.
mbland pushed a commit that referenced this issue Jun 22, 2015
As noted in #14, the default 100KB payload limit was exceeded by a webhook
fired for uswds/uswds#54. Combined with
5d2ee1ec4899e8f4ff0e0f54bb16ac745df6d144 from 18F/hookshot, this change will
allow us to pass options through to the bodyParser.json() middleware to
increase the limit.
@mbland
Copy link
Contributor

mbland commented Jun 22, 2015

So the running server is fixed, but I'll keep this open until coreh/hookshot#12 and #15 are committed and the updated version of hookshot running on https://pages.18f.gov is installed from npm rather than from 18F/hookshot.

@divyatechryde
Copy link

Is this issue fixed or a workaround is available. I see last update was an year ago. I am unable to recollect how it can be resolved though we are waiting to committ.

Error which i received:
Error: request entity too large
at makeError (/var/html/node_modules/raw-body/index.js:184:15)
at module.exports (/var/html/node_modules/raw-body/index.js:40:15)
at read (/var/html/node_modules/body-parser/lib/read.js:62:3)
at jsonParser (/var/html/node_modules/body-parser/lib/types/json.js:87:5)
at Layer.handle [as handle_request] (/var/html/node_modules/hookshot/node_m$
at trim_prefix (/var/html/node_modules/hookshot/node_modules/express/lib/ro$
at /var/html/node_modules/hookshot/node_modules/express/lib/router/index.js$
at Function.proto.process_params (/var/html/node_modules/hookshot/node_modu$
at /var/html/node_modules/hookshot/node_modules/express/lib/router/index.js$
at Function.match_layer (/var/html/node_modules/hookshot/node_modules/expre$

@wslack
Copy link
Contributor

wslack commented Jun 13, 2016

@divyatechryde I'm not sure coreh/hookshot#12 was committed.

nihonjinrxs pushed a commit to nihonjinrxs/data-driven-government that referenced this issue Jul 2, 2016
Merge 18f-pages-staging, including favicons
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants