Node app on Heroku - getting “Application Error”

TypeError: OAuth2Strategy requires a clientID option

2020-04-27T03:11:38.707330+00:00 app[web.1]: TypeError: OAuth2Strategy requires a clientID option
2020-04-27T03:11:38.707330+00:00 app[web.1]: at Strategy.OAuth2Strategy (/app/node_modules/passport-oauth2/lib/strategy.js:86:34)
2020-04-27T03:11:38.707331+00:00 app[web.1]: at new Strategy (/app/node_modules/passport-google-oauth20/lib/strategy.js:52:18)
2020-04-27T03:11:38.707331+00:00 app[web.1]: at Object.<anonymous> (/app/app.js:91:14)
2020-04-27T03:11:38.707331+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1156:30)
2020-04-27T03:11:38.707332+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
2020-04-27T03:11:38.707332+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:1000:32)
2020-04-27T03:11:38.707333+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:899:14)
2020-04-27T03:11:38.707333+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
2020-04-27T03:11:38.707333+00:00 app[web.1]: at internal/main/run_main_module.js:18:47

can any1 please help me to rectify the problem

passport.use(new GoogleStrategy({
  clientID: process.env.CLIENT_ID,
  clientSecret: process.env.CLIENT_SECRET,
    callbackURL: "",
    userProfileURL: ""
  function(accessToken, refreshToken, profile, cb) {
  //  console.log(profile);

    User.findOrCreate({ googleId: }, function (err, user) {
      return cb(err, user);

@BenGitter Can you please help?
I am getting this error on heroku logs!

My git repo is:

You are using process.env.port instead of process.env.PORT.

Are you sure process.env.CLIENT_ID contains the clientID?

thanks, it worked!
Can u also help me with HTML?

In navigation bar a CSS class ‘in’ is dynamically added. I have not coded anything like that.

This is my application URL
https : // kisan - sewa. herokuapp. com/

Remove all spaces from the link, I was not being allowed to upload a link.

please help not able to deploy

Yes it contains clientID only. I’ve checked it thrice.

https : // www . agiratech . com / how-to-deploy-angular-application-to-heroku/

Use this blog to take help in deploying your Angular project.

Me too struggled a lot in deploying but this one was it, and now mine is deployed!

still getting same error…please help…thankyou


Please update your github repo following the steps suggested in the above mentioned link, and then revert so that I can check.

I am having the same error, but I work on react js. Please let me know if you find the solution.

Hello camper, hello @BenGitter, I have been working on same issue for days. I tried deploying my app on heroku it gave out an error. so I had to check out my logs, this is what i got

Here is the link to my repository.

@BenGitter i need your help

i have made the changes suggested.


Bring out server.js out in the root folder. There is no need of seperate server folder!
One package.json and package-lock.json are enough to deploy your code.

In package.json you need to make a few changes, change the start script to ‘node server.js’
Also copy “@angular/cli” & “@angular/compiler-cli” form devDependencies to dependencies.
npm install express and path and then, you shall be good to go!

this is a useful link for react devs in order to avoid this issue

I ran into a problem

help me please

Hi @BenGitter

I am getting an error while using multer to upload multiple files, for a single file, it is working fine. I am pasting the code here.

const storage = multer.diskStorage({

destination: (req, file, cb) => {


    cb(null, './public/images/sells');


filename: (req, file, cb) => {


    cb(null, `${}-${file.originalname}`);



const upload = multer({ storage });

// routes’’, upload.array(‘picture’, 5), sellController.setItemForSale);

router.get(’’, sellController.getItemsForSale);

I am getting an error ‘Unexpected field’ in the response of this API.

Please help!