带Heroku主机的Meteor.js应用程序(连接MongoLab数据库) - 应用程序出错,无法提供您的页面

时间:2016-02-19 21:42:22

标签: mongodb heroku meteor mlab

我正在尝试将我的Meteor.js应用程序部署到Heroku。我在没有附加数据库的情况下做得很好,但现在我正在尝试附加我的MongoLab数据库实例。当我尝试设置时,我现在收到错误:

Application Error
An error occurred in the application and your page could not be served. Please try again in a few moments.

If you are the application owner, check your logs for details.

我接受了这个建议,并运行了heroku日志。我看到的日志中的主要错误是:

Error: failed to connect to [1:27017]

输入heroku config | grep MONGOLAB_URI时,我得到输出(实际URI因为显而易见的原因而改变):

MONGOLAB_URI: mongodb://heroku_8b43cf1g:besd10gsdgwertyapp2l4q9asd@ds69123.mongolab.com:69123/heroku_8b43cf1g  

我的heroku记录输出:

2016-02-19T20:40:58.212644+00:00 heroku[router]: at=info method=GET path="/images/thisgray.png" host=www.mobapp.com request_id=f8233fb6-05d0-4b10-92c5-9c6c56a7de37 fwd="98.234.89.85" dyno=web.1 connect=1ms service=22ms status=200 bytes=21894
2016-02-19T20:40:58.394914+00:00 heroku[router]: at=info method=GET path="/images/thisthing.png" host=www.mobapp.com request_id=3e8d9359-df99-48a3-bdd8-8c64ef3bb53b fwd="98.234.89.85" dyno=web.1 connect=1ms service=5ms status=200 bytes=1448
2016-02-19T20:41:07.603609+00:00 heroku[router]: at=info method=GET path="/sockjs/048/myjmakg8/websocket" host=www.mobapp.com request_id=3d3e76d2-a61f-4367-a739-6c235c2ad41e fwd="98.234.89.85" dyno=web.1 connect=1ms service=8820ms status=101 bytes=175
2016-02-19T21:06:48.502986+00:00 heroku[api]: Set MONGO_URL config vars by bob@gmail.com
2016-02-19T21:06:48.502986+00:00 heroku[api]: Release v9 created by bob@gmail.com
2016-02-19T21:06:48.631929+00:00 heroku[web.1]: Restarting
2016-02-19T21:06:48.632533+00:00 heroku[web.1]: State changed from up to starting
2016-02-19T21:06:50.605685+00:00 heroku[web.1]: Starting process with command `.meteor/heroku_build/bin/node .meteor/heroku_build/app/main.js`
2016-02-19T21:06:51.951293+00:00 app[web.1]: 
2016-02-19T21:06:51.951359+00:00 app[web.1]: /app/.meteor/heroku_build/app/programs/server/node_modules/fibers/future.js:278
2016-02-19T21:06:51.951567+00:00 app[web.1]:                    throw(ex);
2016-02-19T21:06:51.951569+00:00 app[web.1]:                          ^
2016-02-19T21:06:52.027676+00:00 app[web.1]: Error: failed to connect to [1:27017]
2016-02-19T21:06:52.027680+00:00 app[web.1]:     at Object.Future.wait (/app/.meteor/heroku_build/app/programs/server/node_modules/fibers/future.js:398:15)
2016-02-19T21:06:52.027682+00:00 app[web.1]:     at new MongoConnection (packages/mongo/mongo_driver.js:213:1)
2016-02-19T21:06:52.027683+00:00 app[web.1]:     at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:1)
2016-02-19T21:06:52.027683+00:00 app[web.1]:     at Object.<anonymous> (packages/mongo/remote_collection_driver.js:38:1)
2016-02-19T21:06:52.027684+00:00 app[web.1]:     at Object.defaultRemoteCollectionDriver (packages/underscore/underscore.js:750:1)
2016-02-19T21:06:52.027686+00:00 app[web.1]:     at mobapp.js:1:12
2016-02-19T21:06:52.027685+00:00 app[web.1]:     at new Mongo.Collection (packages/mongo/collection.js:102:1)
2016-02-19T21:06:52.027687+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/app/mobapp.js:20:4
2016-02-19T21:06:52.027688+00:00 app[web.1]:     at Array.forEach (native)
2016-02-19T21:06:52.027687+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/boot.js:242:10
2016-02-19T21:06:52.027689+00:00 app[web.1]:     - - - - -
2016-02-19T21:06:52.027691+00:00 app[web.1]:     at [object Object].<anonymous> (/app/.meteor/heroku_build/app/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/server.js:556:74)
2016-02-19T21:06:52.027692+00:00 app[web.1]:     at [object Object].emit (events.js:106:17)
2016-02-19T21:06:52.027693+00:00 app[web.1]:     at [object Object].<anonymous> (/app/.meteor/heroku_build/app/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:156:15)
2016-02-19T21:06:52.027694+00:00 app[web.1]:     at [object Object].emit (events.js:98:17)
2016-02-19T21:06:52.027695+00:00 app[web.1]:     at Socket.<anonymous> (/app/.meteor/heroku_build/app/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/connection.js:534:10)
2016-02-19T21:06:52.027696+00:00 app[web.1]:     at Socket.emit (events.js:95:17)
2016-02-19T21:06:52.027696+00:00 app[web.1]:     at net.js:441:14
2016-02-19T21:06:52.027697+00:00 app[web.1]:     at process._tickCallback (node.js:448:13)
2016-02-19T21:06:52.536968+00:00 heroku[web.1]: State changed from starting to crashed
2016-02-19T21:06:52.538299+00:00 heroku[web.1]: State changed from crashed to starting
2016-02-19T21:06:52.499425+00:00 heroku[web.1]: Process exited with status 8
2016-02-19T21:06:53.132126+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2016-02-19T21:06:55.376840+00:00 heroku[web.1]: Process exited with status 143
2016-02-19T21:06:58.410626+00:00 heroku[web.1]: Starting process with command `.meteor/heroku_build/bin/node .meteor/heroku_build/app/main.js`
2016-02-19T21:07:01.046013+00:00 app[web.1]: 
2016-02-19T21:07:01.046088+00:00 app[web.1]: /app/.meteor/heroku_build/app/programs/server/node_modules/fibers/future.js:278
2016-02-19T21:07:01.046292+00:00 app[web.1]:                    throw(ex);
2016-02-19T21:07:01.046296+00:00 app[web.1]:                          ^
2016-02-19T21:07:01.154404+00:00 app[web.1]: Error: failed to connect to [1:27017]
2016-02-19T21:07:01.154407+00:00 app[web.1]:     at Object.Future.wait (/app/.meteor/heroku_build/app/programs/server/node_modules/fibers/future.js:398:15)
2016-02-19T21:07:01.154408+00:00 app[web.1]:     at new MongoConnection (packages/mongo/mongo_driver.js:213:1)
2016-02-19T21:07:01.154409+00:00 app[web.1]:     at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:1)
2016-02-19T21:07:01.154410+00:00 app[web.1]:     at Object.defaultRemoteCollectionDriver (packages/underscore/underscore.js:750:1)
2016-02-19T21:07:01.154409+00:00 app[web.1]:     at Object.<anonymous> (packages/mongo/remote_collection_driver.js:38:1)
2016-02-19T21:07:01.154410+00:00 app[web.1]:     at new Mongo.Collection (packages/mongo/collection.js:102:1)
2016-02-19T21:07:01.154411+00:00 app[web.1]:     at mobapp.js:1:12
2016-02-19T21:07:01.154412+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/boot.js:242:10
2016-02-19T21:07:01.154413+00:00 app[web.1]:     - - - - -
2016-02-19T21:07:01.154412+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/app/mobapp.js:20:4
2016-02-19T21:07:01.154415+00:00 app[web.1]:     at [object Object].<anonymous> (/app/.meteor/heroku_build/app/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/server.js:556:74)
2016-02-19T21:07:01.154412+00:00 app[web.1]:     at Array.forEach (native)
2016-02-19T21:07:01.154415+00:00 app[web.1]:     at [object Object].emit (events.js:106:17)
2016-02-19T21:07:01.154416+00:00 app[web.1]:     at [object Object].<anonymous> (/app/.meteor/heroku_build/app/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:156:15)
2016-02-19T21:07:01.154416+00:00 app[web.1]:     at [object Object].emit (events.js:98:17)
2016-02-19T21:07:01.154418+00:00 app[web.1]:     at Socket.emit (events.js:95:17)
2016-02-19T21:07:01.154417+00:00 app[web.1]:     at Socket.<anonymous> (/app/.meteor/heroku_build/app/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/connection.js:534:10)
2016-02-19T21:07:01.154418+00:00 app[web.1]:     at net.js:441:14
2016-02-19T21:07:01.154419+00:00 app[web.1]:     at process._tickCallback (node.js:448:13)
2016-02-19T21:07:01.842656+00:00 heroku[web.1]: State changed from starting to crashed
2016-02-19T21:07:01.806613+00:00 heroku[web.1]: Process exited with status 8
2016-02-19T21:07:03.341588+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/sockjs/info?cb=8qpqf_gwxg" host=www.mobapp.com request_id=21a3ddc9-156e-45de-a6c9-c9b167ccf92b fwd="98.234.89.85" dyno= connect= service= status=503 bytes=
2016-02-19T21:07:12.176992+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/sockjs/info?cb=m_a3ombq8n" host=www.mobapp.com request_id=3735d992-8f04-46ed-90f6-6326f7949b8b fwd="98.234.89.85" dyno= connect= service= status=503 bytes=
2016-02-19T21:07:54.617993+00:00 heroku[api]: Set ROOT_URL config vars by bob@gmail.com
2016-02-19T21:07:54.618032+00:00 heroku[api]: Release v10 created by bob@gmail.com
2016-02-19T21:07:54.711020+00:00 heroku[web.1]: State changed from crashed to starting
2016-02-19T21:07:58.396900+00:00 heroku[web.1]: Starting process with command `.meteor/heroku_build/bin/node .meteor/heroku_build/app/main.js`
2016-02-19T21:08:01.569711+00:00 app[web.1]: 
2016-02-19T21:08:01.569863+00:00 app[web.1]: /app/.meteor/heroku_build/app/programs/server/node_modules/fibers/future.js:278
2016-02-19T21:08:01.740472+00:00 app[web.1]: Error: failed to connect to [1:27017]
2016-02-19T21:08:01.740477+00:00 app[web.1]:     at Object.Future.wait (/app/.meteor/heroku_build/app/programs/server/node_modules/fibers/future.js:398:15)
2016-02-19T21:08:01.570213+00:00 app[web.1]:                    throw(ex);
2016-02-19T21:08:01.570217+00:00 app[web.1]:                          ^
2016-02-19T21:08:01.740479+00:00 app[web.1]:     at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:1)
2016-02-19T21:08:01.740479+00:00 app[web.1]:     at Object.<anonymous> (packages/mongo/remote_collection_driver.js:38:1)
2016-02-19T21:08:01.740484+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/boot.js:242:10
2016-02-19T21:08:01.740482+00:00 app[web.1]:     at mobapp.js:1:12
2016-02-19T21:08:01.740478+00:00 app[web.1]:     at new MongoConnection (packages/mongo/mongo_driver.js:213:1)
2016-02-19T21:08:01.740486+00:00 app[web.1]:     - - - - -
2016-02-19T21:08:01.740483+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/app/mobapp.js:20:4
2016-02-19T21:08:01.740485+00:00 app[web.1]:     at Array.forEach (native)
2016-02-19T21:08:01.740488+00:00 app[web.1]:     at [object Object].<anonymous> (/app/.meteor/heroku_build/app/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/server.js:556:74)
2016-02-19T21:08:01.740481+00:00 app[web.1]:     at Object.defaultRemoteCollectionDriver (packages/underscore/underscore.js:750:1)
2016-02-19T21:08:01.740481+00:00 app[web.1]:     at new Mongo.Collection (packages/mongo/collection.js:102:1)
2016-02-19T21:08:01.740489+00:00 app[web.1]:     at [object Object].emit (events.js:106:17)
2016-02-19T21:08:01.740492+00:00 app[web.1]:     at Socket.emit (events.js:95:17)
2016-02-19T21:08:01.740492+00:00 app[web.1]:     at Socket.<anonymous> (/app/.meteor/heroku_build/app/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/connection.js:534:10)
2016-02-19T21:08:01.740494+00:00 app[web.1]:     at process._tickCallback (node.js:448:13)
2016-02-19T21:08:01.740491+00:00 app[web.1]:     at [object Object].emit (events.js:98:17)
2016-02-19T21:08:01.740493+00:00 app[web.1]:     at net.js:441:14
2016-02-19T21:08:01.740490+00:00 app[web.1]:     at [object Object].<anonymous> (/app/.meteor/heroku_build/app/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:156:15)
2016-02-19T21:08:02.990797+00:00 heroku[web.1]: Process exited with status 8
2016-02-19T21:08:03.009142+00:00 heroku[web.1]: State changed from starting to crashed
2016-02-19T21:07:27.705989+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/sockjs/info?cb=5ncaj4hnta" host=www.mobapp.com request_id=6537152d-31dc-4a10-87f7-b05811a1cab0 fwd="98.234.89.85" dyno= connect= service= status=503 bytes=
2016-02-19T21:09:12.941530+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/sockjs/info?cb=xs2810gm5u" host=www.mobapp.com request_id=a66c3b26-7e28-4be4-8265-1823df31c731 fwd="98.234.89.85" dyno= connect= service= status=503 bytes=
2016-02-19T21:14:51.508051+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=www.mobapp.com request_id=64f988ab-b49c-4fc5-9131-049f15c0e3c1 fwd="98.234.89.85" dyno= connect= service= status=503 bytes=
2016-02-19T21:16:40.850757+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=www.mobapp.com request_id=b9c24f87-e849-43f5-83c9-e438b9dd4985 fwd="98.234.89.85" dyno= connect= service= status=503 bytes=
2016-02-19T21:16:38.941940+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=www.mobapp.com request_id=315428e1-9e3f-4d89-a3e4-0e66476fc1eb fwd="98.234.89.85" dyno= connect= service= status=503 bytes=

1 个答案:

答案 0 :(得分:0)

您是否提供了MONGO_URL环境变量? 类似的东西:

export MONGO_URL=your_mongo_lab_url_here

your_mongo_lab_url_here替换为您的实际mongodb网址。希望这会有所帮助。