ituageorge / exam-timed-backend-app

MIT License
0 stars 0 forks source link

secret should be set #1

Open ituageorge opened 3 years ago

ituageorge commented 3 years ago

Error: secret should be set at module.exports (C:\Users\GEORGE\Desktop\exam-timed-backend-app\node_modules\express-jwt\lib\index.js:20:42) at jwt (C:\Users\GEORGE\Desktop\exam-timed-backend-app_helpers\jwt.js:13:12) at Object. (C:\Users\GEORGE\Desktop\exam-timed-backend-app\server.js:15:9) at Module._compile (internal/modules/cjs/loader.js:955:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10) at Module.load (internal/modules/cjs/loader.js:811:32) at Function.Module._load (internal/modules/cjs/loader.js:723:14) at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10) at internal/main/run_main_module.js:17:11 [nodemon] app crashed - waiting for file changes before starting...

Adebolavictor commented 3 years ago

I cant. see the config.json file

Adebolavictor commented 3 years ago

what value type is expected for secret in jwt (C:\Users\GEORGE\Desktop\exam-timed-backend-app_helpers\jwt.js:13:12)

Adebolavictor commented 3 years ago

are you there?

Adebolavictor commented 3 years ago

String or JSON?

ituageorge commented 3 years ago

string

Adebolavictor commented 3 years ago

put the value in the config file directly into the secret param of the function and see if it works

ituageorge commented 3 years ago

goodafternoon The secret is working now

On Sun, Jan 17, 2021 at 2:53 PM Adebola Victor notifications@github.com wrote:

put the value in the config file directly into the secret param of the function and see if it works

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ituageorge/exam-timed-backend-app/issues/1#issuecomment-761816138, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMB4HO3RYARHZUCTICHODXDS2LTXNANCNFSM4WFFNOKA .

Adebolavictor commented 3 years ago

How did you resolve it?

ituageorge commented 3 years ago

I omitted to put require('rootpath')() at the beginning of the file to require or import the file name directly without having to trace the path Or simply require the file by using the path eg const jwt = require( '../_helpers/jwt');

On Mon, Jan 18, 2021 at 2:36 PM itua osagie ituaosagie100@gmail.com wrote:

goodafternoon The secret is working now

On Sun, Jan 17, 2021 at 2:53 PM Adebola Victor notifications@github.com wrote:

put the value in the config file directly into the secret param of the function and see if it works

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ituageorge/exam-timed-backend-app/issues/1#issuecomment-761816138, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMB4HO3RYARHZUCTICHODXDS2LTXNANCNFSM4WFFNOKA .

ituageorge commented 3 years ago

This is showing at the console: Server listening on port 80 (node:11132) UnhandledPromiseRejectionWarning: MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/ at NativeConnection.Connection.openUri (C:\Users\GEORGE\Desktop\exam-timed-backend-app\node_modules\mongoose\lib\connection.js:832:32) at C:\Users\GEORGE\Desktop\exam-timed-backend-app\node_modules\mongoose\lib\index.js:345:10 at C:\Users\GEORGE\Desktop\exam-timed-backend-app\node_modules\mongoose\lib\helpers\promiseOrCallback.js:31:5 at new Promise () at promiseOrCallback (C:\Users\GEORGE\Desktop\exam-timed-backend-app\node_modules\mongoose\lib\helpers\promiseOrCallback.js:30:10) at Mongoose._promiseOrCallback (C:\Users\GEORGE\Desktop\exam-timed-backend-app\node_modules\mongoose\lib\index.js:1135:10) at Mongoose.connect (C:\Users\GEORGE\Desktop\exam-timed-backend-app\node_modules\mongoose\lib\index.js:344:20) at Object. (C:\Users\GEORGE\Desktop\exam-timed-backend-app_helpers\db.js:6:10) at Module._compile (internal/modules/cjs/loader.js:955:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10) at Module.load (internal/modules/cjs/loader.js:811:32) at Function.Module._load (internal/modules/cjs/loader.js:723:14) at Module.require (internal/modules/cjs/loader.js:848:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (C:\Users\GEORGE\Desktop\exam-timed-backend-app\users\userService.js:5:12) at Module._compile (internal/modules/cjs/loader.js:955:30) (node:11132) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:11132) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

On Mon, Jan 18, 2021 at 3:18 PM itua osagie ituaosagie100@gmail.com wrote:

I omitted to put require('rootpath')() at the beginning of the file to require or import the file name directly without having to trace the path Or simply require the file by using the path eg const jwt = require( '../_helpers/jwt');

On Mon, Jan 18, 2021 at 2:36 PM itua osagie ituaosagie100@gmail.com wrote:

goodafternoon The secret is working now

On Sun, Jan 17, 2021 at 2:53 PM Adebola Victor notifications@github.com wrote:

put the value in the config file directly into the secret param of the function and see if it works

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ituageorge/exam-timed-backend-app/issues/1#issuecomment-761816138, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMB4HO3RYARHZUCTICHODXDS2LTXNANCNFSM4WFFNOKA .

Adebolavictor commented 3 years ago

Open a new issue ticket for it

ituageorge commented 3 years ago

Ok. This particular issue has been resolved

Adebolavictor commented 3 years ago

It's important to share how it was resolved for reference purpose and to help others when they come across the issue