pages
pages copied to clipboard
Increase payload limit
Recently we merged in a rather large pull request for the pattern library project and was rejected b/c of the size: https://github.com/18F/govt-wide-patternlibrary/pull/54
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
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.
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$
@divyatechryde I'm not sure https://github.com/coreh/hookshot/pull/12 was committed.