나는 큰 금액의 JSON을으로 보내는 응용 프로그램을 Heroku에서 호스팅하고 있습니다. 원래 bodyParser 요청 엔터티가 너무 큰 오류 (HTTP 400)가 발생했습니다. 주위에 인터넷 검색, 내가 몇 유래 통해 온/GitHub의 문제가 연결돛 몸통 파서 구성
(Sails.js bodyParser - request entity too large on version 0.10.5) (https://github.com/balderdashy/skipper/issues/144)하는 내가 업데이트 시도
내 http.js.
bodyParser: {
fn: require('skipper'),
options:{
limit: '10mb'
}
}
이가 400 오류를 해결하지만, 지금은 Heroku가 H13 오류가 점점 오전 : 이제 내 몸 파서는 다음과 같습니다이 시점에서
2016-08-11T14:02:08.861774+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response"
, 내가 가지 난처한 상황에 빠진입니다. 나는 H13 오류
(https://devcenter.heroku.com/articles/error-codes#h13-connection-closed-without-response)에 대한 Heroku가 설명서에
을 검토 한하지만 난 내가 심지어 그것에 대해 이동 얼마나 Heroku가 (더 구성 할 필요가 있는지- 경우입니다) 또는
- 항해 bodyParser 구성 또는
- 더 수행이
현재 Sails 버전 0.11.2를 사용 중입니다.
[업데이트]
이 링크에 저를 이끌어 더 확인해 :
https://github.com/balderdashy/sails/issues/2653
https://github.com/balderdashy/skipper/issues/22
나는 개인이 미들웨어 블록 밖에서 bodyParser의 설정을 가지고 나타났습니다. 나는 밖으로 움직이는 광산을 시험해 보았다. 그리고 그것은 내가 받고 있었던 400와 503의 H13 Heroku 문제를 고치는 것으로 보인다. (그리고 나는 천천히 문제로부터 떨어져 나간다.) 내 새로운 질문은, 특히 bodyParser 주석 블록이 미들웨어 블록 안에 있기 때문에 아래에서 왜 작동합니까?
module.exports.http = {
/****************************************************************************
* *
* Express middleware to use for every Sails request. To add custom *
* middleware to the mix, add a function to the middleware config object and *
* add its key to the "order" array. The $custom key is reserved for *
* backwards-compatibility with Sails v0.9.x apps that use the *
* `customMiddleware` config option. *
* *
****************************************************************************/
middleware: {
passportInit: require('passport').initialize(),
passportSession: require('passport').session(),
/***************************************************************************
* *
* The order in which middleware should be run for HTTP request. (the Sails *
* router is invoked by the "router" middleware below.) *
* *
***************************************************************************/
order: [
'startRequestTimer',
'cookieParser',
'session',
'passportInit',
'passportSession',
'myRequestLogger',
'bodyParser',
'handleBodyParserError',
'compress',
'methodOverride',
'poweredBy',
'$custom',
'router',
'www',
'favicon',
'404',
'500'
],
/****************************************************************************
* *
* Example custom middleware; logs each request to the console. *
* *
****************************************************************************/
// myRequestLogger: function (req, res, next) {
// console.log("Requested :: ", req.method, req.url);
// return next();
// }
/***************************************************************************
* *
* The body parser that will handle incoming multipart HTTP requests. By *
* default as of v0.10, Sails uses *
* [skipper](http://github.com/balderdashy/skipper). See *
* http://www.senchalabs.org/connect/multipart.html for other options. *
* *
***************************************************************************/
// bodyParser: require('skipper')
},
/***************************************************************************
* *
* The number of seconds to cache flat files on disk being served by *
* Express static middleware (by default, these files are in `.tmp/public`) *
* *
* The HTTP static cache is only active in a 'production' environment, *
* since that's the only time Express will cache flat-files. *
* *
***************************************************************************/
// cache: 31557600000
bodyParser: function() {
var opts = {limit:'10mb'};
var fn;
// Default to built-in bodyParser:
fn = require('skipper');
return fn(opts);
}
};
전구가 꺼졌습니다. 감사! – danieltjewett