错误:请求实体太大(mean.io)

时间:2015-07-27 13:54:11

标签: angularjs node.js mongodb express mean.io

我正在尝试解析.srt文件并将解析后的对象保存在mongodb集合中。当我上传一个大的srt文件时,我得到的实体太大了。我google了一下,发现了一个快速配置行来增加请求的大小限制,但似乎没有做到这一点。这是我提交保存文件时得到的结果:

JS控制台:

POST                                             (angular.js:10514)
http://localhost:3000/api/subtitles 500 (Internal Server Error)

以下是完整错误:

Error: request entity too large
at readStream (/Users/egills/MEANPanda/node_modules/body-parser/node_modules/raw-body/index.js:179:15)
at getRawBody (/Users/egills/MEANPanda/node_modules/body-parser/node_modules/raw-body/index.js:97:12)
at read (/Users/egills/MEANPanda/node_modules/body-parser/lib/read.js:68:3)
at jsonParser (/Users/egills/MEANPanda/node_modules/body-parser/lib/types/json.js:121:5)
at Layer.handle [as handle_request] (/Users/egills/MEANPanda/node_modules/meanio/lib/core_modules/server/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/egills/MEANPanda/node_modules/meanio/lib/core_modules/server/node_modules/express/lib/router/index.js:312:13)
at /Users/egills/MEANPanda/node_modules/meanio/lib/core_modules/server/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/Users/egills/MEANPanda/node_modules/meanio/lib/core_modules/server/node_modules/express/lib/router/index.js:330:12)
at next (/Users/egills/MEANPanda/node_modules/meanio/lib/core_modules/server/node_modules/express/lib/router/index.js:271:10)
at /Users/egills/MEANPanda/node_modules/meanio/lib/core_modules/server/node_modules/express-validator/lib/express_validator.js:163:5
at Layer.handle [as handle_request] (/Users/egills/MEANPanda/node_modules/meanio/lib/core_modules/server/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/egills/MEANPanda/node_modules/meanio/lib/core_modules/server/node_modules/express/lib/router/index.js:312:13)
at /Users/egills/MEANPanda/node_modules/meanio/lib/core_modules/server/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/Users/egills/MEANPanda/node_modules/meanio/lib/core_modules/server/node_modules/express/lib/router/index.js:330:12)
at next (/Users/egills/MEANPanda/node_modules/meanio/lib/core_modules/server/node_modules/express/lib/router/index.js:271:10)
at cookieParser (/Users/egills/MEANPanda/node_modules/meanio/lib/core_modules/server/node_modules/cookie-parser/index.js:34:14)
at Layer.handle [as handle_request] (/Users/egills/MEANPanda/node_modules/meanio/lib/core_modules/server/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/egills/MEANPanda/node_modules/meanio/lib/core_modules/server/node_modules/express/lib/router/index.js:312:13)
at /Users/egills/MEANPanda/node_modules/meanio/lib/core_modules/server/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/Users/egills/MEANPanda/node_modules/meanio/lib/core_modules/server/node_modules/express/lib/router/index.js:330:12)
at next (/Users/egills/MEANPanda/node_modules/meanio/lib/core_modules/server/node_modules/express/lib/router/index.js:271:10)
at /Users/egills/MEANPanda/node_modules/meanio/lib/core_modules/server/ExpressEngine.js:41:5

这是http标题:

Accept:application/json, text/plain, */*
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8,is;q=0.6
Authorization:Bearer <long key>
Connection:keep-alive
Content-Length:178471
Content-Type:application/json;charset=UTF-8
Host:localhost:3000
Origin:http://localhost:3000
Referer:http://localhost:3000/subtitles/create
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.107 Safari/537.36

Here是我希望解决它的解决方案,但事实并非如此。我测试的SRT文件是107kb,快速配置是here. 我正在使用开发人员环境中的默认gulp任务运行应用程序。 我是否需要在其他地方添加大小配置?我尝试将它添加到字幕包文件夹中的app.js文件中,但是它也没有。

0 个答案:

没有答案