Increase max payload size in bodyparser to avoid PayloadTooLarge errors

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
Cameron Diver 2019-02-22 10:23:20 +00:00 committed by Giovanni Garufi
parent 58fa0ac761
commit c9507e013c
4 changed files with 8 additions and 8 deletions

View File

@ -867,8 +867,8 @@ export class APIBinder {
private createAPIBinderRouter(apiBinder: APIBinder): express.Router {
const router = express.Router();
router.use(bodyParser.urlencoded({ extended: true }));
router.use(bodyParser.json());
router.use(bodyParser.urlencoded({ limit: '10mb', extended: true }));
router.use(bodyParser.json({ limit: '10mb' }));
router.post('/v1/update', (req, res) => {
apiBinder.eventTracker.track('Update notification');

View File

@ -51,8 +51,8 @@ fetchAction = (service) ->
# Some v1 endpoins only work for single-container apps as they assume the app has a single service.
createApplicationManagerRouter = (applications) ->
router = express.Router()
router.use(bodyParser.urlencoded(extended: true))
router.use(bodyParser.json())
router.use(bodyParser.urlencoded({ extended: true, limit: '10mb' }))
router.use(bodyParser.json({ limit: '10mb' }))
createV1Api(router, applications)
createV2Api(router, applications)

View File

@ -48,8 +48,8 @@ validateState = Promise.method (state) ->
# device api stuff in ./device-api
createDeviceStateRouter = (deviceState) ->
router = express.Router()
router.use(bodyParser.urlencoded(extended: true))
router.use(bodyParser.json())
router.use(bodyParser.urlencoded(limit: '10mb', extended: true))
router.use(bodyParser.json(limit: '10mb'))
rebootOrShutdown = (req, res, action) ->
deviceState.config.get('lockOverride')

View File

@ -71,8 +71,8 @@ formatCurrentAsState = (device) ->
createProxyvisorRouter = (proxyvisor) ->
{ db } = proxyvisor
router = express.Router()
router.use(bodyParser.urlencoded(extended: true))
router.use(bodyParser.json())
router.use(bodyParser.urlencoded(limit: '10mb', extended: true))
router.use(bodyParser.json(limit: '10mb'))
router.get '/v1/devices', (req, res) ->
db.models('dependentDevice').select()
.map(parseDeviceFields)