应用程序中发生错误,无法提供您的页面。

时间:2018-09-04 06:44:33

标签: node.js heroku deployment

我正在尝试使用heroku部署我的应用程序,但是每次显示错误时,我都会尝试。 我的网站https://bitbucket.org/shanky_2107/cms_node_js/src/master/CMS/的Bitbucket链接 如果要查看应用程序的代码。

    2018-09-04T06:27:15.431388+00:00 heroku[web.1]: Starting process with command `npm start`
2018-09-04T06:27:18.531623+00:00 app[web.1]:
2018-09-04T06:27:18.531642+00:00 app[web.1]: > cms@1.0.1 start /app
2018-09-04T06:27:18.531644+00:00 app[web.1]: > node app.js
2018-09-04T06:27:18.531646+00:00 app[web.1]:
2018-09-04T06:27:19.601937+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2018-09-04T06:27:19.601957+00:00 app[web.1]: designed for a production environment, as it will leak
2018-09-04T06:27:19.601961+00:00 app[web.1]: memory, and will not scale past a single process.
2018-09-04T06:27:20.375111+00:00 app[web.1]: at parseConnectionString (/app/node_modules/mongodb/lib/url_parser.js:176:13)
2018-09-04T06:27:20.375099+00:00 app[web.1]: Error: Username containing an unescaped at-sign
2018-09-04T06:27:20.375114+00:00 app[web.1]: at parseHandler (/app/node_modules/mongodb/lib/url_parser.js:119:14)
2018-09-04T06:27:20.375115+00:00 app[web.1]: at module.exports (/app/node_modules/mongodb/lib/url_parser.js:25:12)
2018-09-04T06:27:20.375117+00:00 app[web.1]: at connect (/app/node_modules/mongodb/lib/mongo_client.js:874:3)
2018-09-04T06:27:20.375118+00:00 app[web.1]: at connectOp (/app/node_modules/mongodb/lib/mongo_client.js:269:3)
2018-09-04T06:27:20.375120+00:00 app[web.1]: at executeOperation (/app/node_modules/mongodb/lib/utils.js:419:24)
2018-09-04T06:27:20.375122+00:00 app[web.1]: at MongoClient.connect (/app/node_modules/mongodb/lib/mongo_client.js:260:10)
2018-09-04T06:27:20.375124+00:00 app[web.1]: at Promise (/app/node_modules/mongoose/lib/connection.js:427:12)
2018-09-04T06:27:20.375126+00:00 app[web.1]: at new Promise (<anonymous>)
2018-09-04T06:27:20.375128+00:00 app[web.1]: at NativeConnection.Connection.openUri (/app/node_modules/mongoose/lib/connection.js:424:19)
2018-09-04T06:27:20.375129+00:00 app[web.1]: at Mongoose.connect (/app/node_modules/mongoose/lib/index.js:207:15)
2018-09-04T06:27:20.375131+00:00 app[web.1]: at Object.<anonymous> (/app/app.js:18:10)
2018-09-04T06:27:20.375133+00:00 app[web.1]: at Module._compile (module.js:652:30)
2018-09-04T06:27:20.375135+00:00 app[web.1]: at Object.Module._extensions..js (module.js:663:10)
2018-09-04T06:27:20.375136+00:00 app[web.1]: at Module.load (module.js:565:32)
2018-09-04T06:27:20.375138+00:00 app[web.1]: at tryModuleLoad (module.js:505:12)
2018-09-04T06:27:20.376975+00:00 app[web.1]: listening on port 21277
2018-09-04T06:27:21.091384+00:00 heroku[web.1]: State changed from starting to up
2018-09-04T06:28:13.799191+00:00 heroku[router]: at=info method=GET path="/robots.txt" host=thawing-brushlands-91259.herokuapp.com request_id=197f0f56-aba8-47ad-8f0a-d18fbb987d42 fwd="122.162.24.61" dyno=web.1 connect=1ms service=30ms status=302 bytes=342 protocol=https
2018-09-04T06:28:43.726779+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=thawing-brushlands-91259.herokuapp.com request_id=33d15316-02a5-45d7-bed7-46e6feb52f4f fwd="122.162.24.61" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0 protocol=https
2018-09-04T06:28:44.730759+00:00 heroku[router]: at=info method=GET path="/robots.txt" host=thawing-brushlands-91259.herokuapp.com request_id=d618ac8b-1cf4-429d-90e0-a184b4002443 fwd="122.162.24.61" dyno=web.1 connect=1ms service=4ms status=302 bytes=212 protocol=https
2018-09-04T06:28:45.031657+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=thawing-brushlands-91259.herokuapp.com request_id=b258180e-8452-4a2c-a47a-37a3c1b42058 fwd="122.162.24.61" dyno=web.1 connect=0ms service=7ms status=302 bytes=212 protocol=https
2018-09-04T06:29:04.113724+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=thawing-brushlands-91259.herokuapp.com request_id=082fa342-5c79-4bb4-9bb9-fc9d84990058 fwd="122.162.24.61" dyno=web.1 connect=1ms service=30001ms status=503 bytes=0 protocol=https
2018-09-04T06:29:15.073424+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=thawing-brushlands-91259.herokuapp.com request_id=aa089785-742c-45c4-8fdf-4002afa634a8 fwd="122.162.24.61" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0 protocol=https
2018-09-04T06:29:35.330371+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=thawing-brushlands-91259.herokuapp.com request_id=8976a615-8d12-47e3-8e90-0b4b40cdfcfd fwd="122.162.24.61" dyno=web.1 connect=1ms service=30001ms status=503 bytes=0 protocol=https

1 个答案:

答案 0 :(得分:0)

您的连接字符串似乎包含一些必须转义的字符。例如'@'。基于该错误,我认为您的用户名中包含该字符。尝试使用以下语法建立与数据库的连接。应该解决问题

mongoose.connect('mongodb://localhost/test',
                 {user: 'username', pass: 'p@ssword'},
                 callback);

阅读猫鼬docs以获得更多详细信息