Worklenz / worklenz

All in one project management tool for efficient teams
https://worklenz.com
GNU Affero General Public License v3.0
857 stars 47 forks source link

Docker issue: (worklenz_backend won't start) OAuth2Strategy requires a clientID option #16

Closed SS88UK closed 1 month ago

SS88UK commented 1 month ago
worklenz_backend   | 
worklenz_backend   | > worklenz-backend@1.4.16 start
worklenz_backend   | > node ./build/bin/www
worklenz_backend   | 
worklenz_backend   | /usr/src/app/node_modules/passport-oauth2/lib/strategy.js:87
worklenz_backend   |   if (!options.clientID) { throw new TypeError('OAuth2Strategy requires a clientID option'); }
worklenz_backend   |                            ^
worklenz_backend   | 
worklenz_backend   | TypeError: OAuth2Strategy requires a clientID option
worklenz_backend   |     at Strategy.OAuth2Strategy (/usr/src/app/node_modules/passport-oauth2/lib/strategy.js:87:34)
worklenz_backend   |     at new Strategy (/usr/src/app/node_modules/passport-google-oauth20/lib/strategy.js:52:18)
worklenz_backend   |     at Object.<anonymous> (/usr/src/app/build/passport/passport-strategies/passport-google.js:56:19)
worklenz_backend   |     at Module._compile (node:internal/modules/cjs/loader:1364:14)
worklenz_backend   |     at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
worklenz_backend   |     at Module.load (node:internal/modules/cjs/loader:1203:32)
worklenz_backend   |     at Module._load (node:internal/modules/cjs/loader:1019:12)
worklenz_backend   |     at Module.require (node:internal/modules/cjs/loader:1231:19)
worklenz_backend   |     at require (node:internal/modules/helpers:177:18)
worklenz_backend   |     at Object.<anonymous> (/usr/src/app/build/passport/index.js:6:51)
worklenz_backend   |     at Module._compile (node:internal/modules/cjs/loader:1364:14)
worklenz_backend   |     at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
worklenz_backend   |     at Module.load (node:internal/modules/cjs/loader:1203:32)
worklenz_backend   |     at Module._load (node:internal/modules/cjs/loader:1019:12)
worklenz_backend   |     at Module.require (node:internal/modules/cjs/loader:1231:19)
worklenz_backend   |     at require (node:internal/modules/helpers:177:18)
worklenz_backend   | 
worklenz_backend   | Node.js v18.20.3
worklenz_backend exited with code 1

Any help is appreciated!

Nadeera3784 commented 1 month ago

Hi @SS88UK ,

The issue you're encountering may be due to missing keys or an inability to read the environment variables.

Please ensure you have added the following entries to your environment configuration:

GOOGLE_CLIENT_ID="GOOGLE_CLIENT_ID_HERE"
GOOGLE_CLIENT_SECRET="GOOGLE_CLIENT_SECRET_HERE"

If the problem persists, you can manually update the keys in the file worklenz-backend/src/passport/passport-strategies/passport-google.ts at line 67.

export default new GoogleStrategy.Strategy({
    clientID: "GOOGLE_CLIENT_ID_HERE",
    clientSecret: "GOOGLE_CLIENT_SECRET_HERE",
    callbackURL: process.env.GOOGLE_CALLBACK_URL as string,
    passReqToCallback: true
  },
  (req, _accessToken, _refreshToken, profile, done) => void handleGoogleLogin(req, _accessToken, _refreshToken, profile, done));

At least, this should help you set up the project correctly.

SS88UK commented 1 month ago

@Nadeera3784 Understood thank you!