Ошибка приложения при развертывании на Heroku (проблема mabye с google Oauth) - PullRequest
0 голосов
/ 06 августа 2020

Я пытаюсь развернуть приложение на Heroku. Строительство прошло успешно, но я получаю сообщение об ошибке приложения, когда открываю его. Я думаю, что это может быть связано с частью Google OAuth, но не совсем уверен ...

Ниже представлена ​​часть моего паспорта Google:

passport.use(new GoogleStrategy({
    clientID: process.env.GOOGLE_CLIENT_ID,
    clientSecret: process.env.GOOGLE_CLIENT_SECRET,
    callbackURL: "https://still-inlet-30675.herokuapp.com/auth/google/mywedding"
  },
  function(accessToken, refreshToken, profile, cb) {
    User.findOrCreate({
      googleId: profile.id,
      username: profile.id
    }, function(err, user) {
      return cb(err, user);
    });
  }
));

Ниже мои журналы:

$ heroku logs --tail
2020-08-06T14:25:24.701766+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1138:30)
2020-08-06T14:25:24.701766+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
2020-08-06T14:25:24.701766+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:986:32)
2020-08-06T14:25:24.701767+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:879:14)
2020-08-06T14:25:24.701767+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
2020-08-06T14:25:24.701768+00:00 app[web.1]: at internal/main/run_main_module.js:17:47
2020-08-06T14:25:24.789641+00:00 heroku[web.1]: Process exited with status 1
2020-08-06T14:25:24.843440+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-06T14:25:25.530771+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=still-inlet-30675.herokuapp.com request_id=10cedd0c-c439-48db-8fba-b768a9015ad2 fwd="50.93.222.101" dyno= connect= service= status=503 bytes= protocol=https
2020-08-06T14:25:26.078221+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=still-inlet-30675.herokuapp.com request_id=2ed83109-76a3-42e6-a75a-3744bb5a36f4 fwd="50.93.222.101" dyno= connect= service= status=503 bytes= protocol=https
2020-08-06T14:30:26.000000+00:00 app[api]: Build started by user ccjglingm07@gmail.com
2020-08-06T14:30:43.697695+00:00 app[api]: Deploy ad84197e by user ccjglingm07@gmail.com
2020-08-06T14:30:43.697695+00:00 app[api]: Release v6 created by user ccjglingm07@gmail.com
2020-08-06T14:30:43.961135+00:00 heroku[web.1]: State changed from crashed to starting
2020-08-06T14:30:44.000000+00:00 app[api]: Build succeeded
2020-08-06T14:30:46.955639+00:00 heroku[web.1]: Starting process with command `node app.js`
2020-08-06T14:30:49.197236+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2020-08-06T14:30:49.197254+00:00 app[web.1]: designed for a production environment, as it will leak
2020-08-06T14:30:49.197254+00:00 app[web.1]: memory, and will not scale past a single process.
2020-08-06T14:30:49.203300+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2020-08-06T14:30:49.203301+00:00 app[web.1]: designed for a production environment, as it will leak
2020-08-06T14:30:49.203301+00:00 app[web.1]: memory, and will not scale past a single process.
2020-08-06T14:30:49.216504+00:00 app[web.1]: /app/node_modules/passport-oauth2/lib/strategy.js:86
2020-08-06T14:30:49.216505+00:00 app[web.1]: if (!options.clientID) { throw new TypeError('OAuth2Strategy requires a clientID option'); }
2020-08-06T14:30:49.216506+00:00 app[web.1]: ^
2020-08-06T14:30:49.216506+00:00 app[web.1]:
2020-08-06T14:30:49.216507+00:00 app[web.1]: TypeError: OAuth2Strategy requires a clientID option
2020-08-06T14:30:49.216507+00:00 app[web.1]: at Strategy.OAuth2Strategy (/app/node_modules/passport-oauth2/lib/strategy.js:86:34)
2020-08-06T14:30:49.216508+00:00 app[web.1]: at new Strategy (/app/node_modules/passport-google-oauth20/lib/strategy.js:52:18)
2020-08-06T14:30:49.216508+00:00 app[web.1]: at Object.<anonymous> (/app/app.js:68:14)
2020-08-06T14:30:49.216508+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1138:30)
2020-08-06T14:30:49.216509+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
2020-08-06T14:30:49.216509+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:986:32)
2020-08-06T14:30:49.216510+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:879:14)
2020-08-06T14:30:49.216510+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
2020-08-06T14:30:49.216511+00:00 app[web.1]: at internal/main/run_main_module.js:17:47
2020-08-06T14:30:49.268848+00:00 heroku[web.1]: Process exited with status 1
2020-08-06T14:30:49.311665+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-06T14:30:49.674113+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=still-inlet-30675.herokuapp.com request_id=214471df-b7dd-4363-abe7-98f0f3911651 fwd="50.93.222.101" dyno= connect= service= status=503 bytes= protocol=https
2020-08-06T14:30:50.338647+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=still-inlet-30675.herokuapp.com request_id=a2def04e-82d5-4237-9eca-e61c1280d898 fwd="50.93.222.101" dyno= connect= service= status=503 bytes= protocol=https```

1 Ответ

0 голосов
/ 06 августа 2020

Вы установили переменную env?

  1. clientID: process.env.GOOGLE_CLIENT_ID,
  2. clientSecret: process.env.GOOGLE_CLIENT_SECRET

Сделать это, перейдя в настройки и откройте config.

...