connect.session()警告,随后导致错误R10我在做什么错?

时间:2018-12-04 21:50:35

标签: javascript node.js heroku

我正在尝试将我的Web应用程序部署到Heroku,但我一直收到此错误。我试图更改为Heroku上的process.env.PORT以匹配我使用app.listen()设置的本地端口,就像某些解决方案建议的那样,但无济于事。有什么错误吗?

C:\Users\ftrou\Documents\nakai\BltraveltApp>heroku logs
2018-12-04T20:55:23.033243+00:00 app[api]: Release v2 created by user ftrouw@protonmail.com
2018-12-04T20:55:23.033243+00:00 app[api]: Enable Logplex by user ftrouw@protonmail.com
2018-12-04T20:55:22.867718+00:00 app[api]: Initial release by user ftrouw@protonmail.com
2018-12-04T20:55:22.867718+00:00 app[api]: Release v1 created by user ftrouw@protonmail.com
2018-12-04T20:55:36.879181+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/" host=quiet-river-71792.herokuapp.com request_id=83e5675e-2122-41c0-ab98-f6b62ade77d7 fwd="115.84.94.30" dyno= connect= service= status=502 bytes= protocol=https
2018-12-04T21:08:49.000000+00:00 app[api]: Build started by user ftrouw@protonmail.com
2018-12-04T21:09:13.490447+00:00 app[api]: Deploy 33cfeceb by user ftrouw@protonmail.com
2018-12-04T21:09:13.490447+00:00 app[api]: Release v3 created by user ftrouw@protonmail.com
2018-12-04T21:09:15.000000+00:00 app[api]: Build succeeded
2018-12-04T21:09:20.255923+00:00 heroku[web.1]: Starting process with command `npm start`
2018-12-04T21:09:23.516780+00:00 app[web.1]:
2018-12-04T21:09:23.516820+00:00 app[web.1]: > bltraveltapp@1.0.0 start /app
2018-12-04T21:09:23.516822+00:00 app[web.1]: > node app.js
2018-12-04T21:09:23.516824+00:00 app[web.1]:
2018-12-04T21:09:25.893800+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2018-12-04T21:09:25.893819+00:00 app[web.1]: designed for a production environment, as it will leak
2018-12-04T21:09:25.893821+00:00 app[web.1]: memory, and will not scale past a single process.
2018-12-04T21:09:25.953606+00:00 app[web.1]: started server
2018-12-04T21:10:20.354699+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2018-12-04T21:10:20.354699+00:00 heroku[web.1]: Stopping process with SIGKILL
2018-12-04T21:10:20.472662+00:00 heroku[web.1]: Process exited with status 137
2018-12-04T21:10:20.501204+00:00 heroku[web.1]: State changed from starting to crashed
2018-12-04T21:10:20.502932+00:00 heroku[web.1]: State changed from crashed to starting
2018-12-04T21:10:26.862116+00:00 heroku[web.1]: Starting process with command `npm start`
2018-12-04T21:10:30.029135+00:00 app[web.1]:
2018-12-04T21:10:30.029163+00:00 app[web.1]: > bltraveltapp@1.0.0 start /app
2018-12-04T21:10:30.029165+00:00 app[web.1]: > node app.js
2018-12-04T21:10:30.029166+00:00 app[web.1]:
2018-12-04T21:10:32.175489+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2018-12-04T21:10:32.175544+00:00 app[web.1]: designed for a production environment, as it will leak
2018-12-04T21:10:32.175547+00:00 app[web.1]: memory, and will not scale past a single process.
2018-12-04T21:10:32.250915+00:00 app[web.1]: started server
2018-12-04T21:11:27.337092+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2018-12-04T21:11:27.337159+00:00 heroku[web.1]: Stopping process with SIGKILL
2018-12-04T21:11:27.455544+00:00 heroku[web.1]: Process exited with status 137
2018-12-04T21:11:27.613851+00:00 heroku[web.1]: State changed from starting to crashed
2018-12-04T21:17:00.724996+00:00 app[api]: Release v4 created by user ftrouw@protonmail.com
2018-12-04T21:17:00.724996+00:00 app[api]: Set process.env.PORT config vars by user ftrouw@protonmail.com
2018-12-04T21:17:07.141109+00:00 heroku[web.1]: Starting process with command `npm start`
2018-12-04T21:17:12.708589+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2018-12-04T21:17:12.708625+00:00 app[web.1]: designed for a production environment, as it will leak
2018-12-04T21:17:12.708626+00:00 app[web.1]: memory, and will not scale past a single process.
2018-12-04T21:17:12.756691+00:00 app[web.1]: started server
2018-12-04T21:18:07.614491+00:00 heroku[web.1]: State changed from starting to crashed
2018-12-04T21:18:07.480062+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2018-12-04T21:18:07.480215+00:00 heroku[web.1]: Stopping process with SIGKILL
2018-12-04T21:18:07.597028+00:00 heroku[web.1]: Process exited with status 137

这是我的app.js文件中的代码

const express         = require("express"),
app                   = express(),
ejsLint               = require('ejs-lint'),
mongoose              = require("mongoose"),
bodyParser            = require("body-parser"),
passport              = require('passport'),
Tour                  = require('./lib/models/tour'),
User                  = require('./lib/models/user'),
methodOverride        = require('method-override'),
nodemailer            = require('nodemailer'),
{google}              = require('googleapis'),
email                 = require('./lib/routes/email.js'),
index                 = require('./lib/routes/admin.js'),
LocalStrategy         = require('passport-local'),
passportLocalMongoose = require('passport-local-mongoose'),
indexRoutes           = require('./lib/routes/index.js'),
adminRoutes           = require('./lib/routes/admin.js'),
emailRoutes           = require('./lib/routes/email.js');


// using modules and adding middleware
app.use(express.static("public"));
app.set("view engine", "ejs");
app.use(bodyParser.urlencoded({extended: true}));
app.use(methodOverride("_method"));
app.use(require('express-session')({
  secret: "nakai resort is a great place to stay",
  resave: false,
  saveUninitialized: false
}))
app.use(passport.initialize());
app.use(passport.session());

passport.use(new LocalStrategy(User.authenticate()));
passport.serializeUser(User.serializeUser());
passport.deserializeUser(User.deserializeUser());

app.use(indexRoutes);
app.use(adminRoutes);
app.use(emailRoutes);
  

let port =  process.env.PORT || 3000;
// start up server
app.listen(port, function(){
  console.log("started server");
});

我正在使用Mlab成功连接到mongodb,希望您至少可以指出我的问题所在。

0 个答案:

没有答案