Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Secret should be set #53

Open
davecyen opened this issue May 14, 2015 · 11 comments
Open

Error: Secret should be set #53

davecyen opened this issue May 14, 2015 · 11 comments

Comments

@davecyen
Copy link

I ran 'npm install' late last night and now my server won't start with the following console error. It looks like this this may be related to a recent mean.io update. Please help! My colleague is also running into the same issue after running 'npm install' this morning.

/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:299
throw err;
^
Error: secret should be set
at module.exports (/app/node_modules/meanio/node_modules/express-jwt/lib/index.js:20:42)

@liorkesos
Copy link
Member

You could try to find the a previous version of meanio before the
expressJWT addition
This should probably be a good place to checkout
8dd8773

Instead of requiring linnovate/mean - see how you can add to your package
json a reference to an older commit look at this for reference...
http://stackoverflow.com/questions/14187956/npm-install-from-git-in-a-specific-version

I crated a tag (0.4.x) for meanio - but have not tested - try to see if you
can reference linnovate/meanio#0.4.x.

An alternative way would be toclone it from git in the time being (untill
you upgrade to 0.5)
Lior

On Thu, May 14, 2015 at 8:11 PM, Dave Yen [email protected] wrote:

I ran 'npm install' late last night and now my server won't start with the
following console error. It looks like this this may be related to a recent
mean.io update. Please help!

/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:299
throw err;
^
Error: secret should be set
at module.exports
(/app/node_modules/meanio/node_modules/express-jwt/lib/index.js:20:42)


Reply to this email directly or view it on GitHub
#53.

Lior Kesos - http://www.linnovate.net
Linnovate - Community Infrastructure Care
mail: [email protected]
office: +972 722500881
cell: +972 524305252
skype: liorkesos

@AhabweEmmanuel
Copy link

Am running through the same issue....did anyone find the answer

@samdesota
Copy link

Same issue here. Interestingly, I'm using my own implementation of JWT and have jsonSecret in my config. Probably not related, but would like to use the expressJWT feature soon.

@ptasker
Copy link

ptasker commented May 20, 2015

Bump, also having this issue.

@ptasker
Copy link

ptasker commented May 20, 2015

Hey just a heads up, I got through the 'Error: secret should be set' issue by adding a 'secret' key to the config/env/development.js file:

secret: "something secret".

I then got another error about a logs folder not existing. So I created that and I'm back in business.

Hope that helps someone!

@jabiers
Copy link

jabiers commented May 22, 2015

I fixed it.

first, add secret:"something you want"

sencond.

in ExpressEngine.js

    //var logsOpt = accessLog(config);
    //this.app.use(require('morgan')(logsOpt.format, logsOpt.options));
    this.app.use(require('morgan')(config.format || 'dev', config.option || {}));

@jwebbdev
Copy link
Member

jwebbdev commented Aug 3, 2015

@liorkesos This was a linnovate/mean issue that's been fixed if you want to close this.

@devdesign12345
Copy link

I am too facing this issue.

@Nikhil-devloper
Copy link

this issue came when we don't provide a secret.

exports.requireSignin = expressJwt({
    secret: process.env.JWT_SECRET
});

I triple check my .env file, JWT_SECRET was there

then I figured out in my main server.js, the order of file execution was incorrect.

first, you should import

require('dotenv').config();

then you write the route to access the file.

const authRoutes = require('./routes/auth');

@chainwithharry
Copy link

used 5.3.1 version of express-jwt and thanks me later.

Since, express -jwt have updated to 6.0.0, but it's difficult to figure out update. If you can figure out it, I will thank you later.

@Levidepsi
Copy link

i have same issue here.. and none of the above solutions worked for me... would appreciate if someone could figure this out...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests