Closed indifferentghost closed 3 years ago
Having issues with checking endpoints due to unable connecting to server. Latest main branch had an error
/Users/yoli/www/course-tracker/node_modules/express/lib/router/route.js:202
throw new Error(msg);
^
Error: Route.get() requires a callback function but got a [object Undefined]
at Route.<computed> [as get] (/Users/yoli/www/course-tracker/node_modules/express/lib/router/route.js:202:15)
at Function.proto.<computed> [as get] (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:510:19)
at Object.<anonymous> (/Users/yoli/www/course-tracker/packages/server/routes/authRoutes.js:5:8)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/Users/yoli/www/course-tracker/packages/server/routes/apiRoutes.js:3:20)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
The issue was resolved by adding 's' to module.exports in server>controllers>auth.js file.
(This was addressed in Ticket 23 auth #72 most recent commit.)
However, ran into another issues with this error.
MongoDB Connected: user-dashboard-shard-00-00.p60yz.mongodb.net
Error: secret option required for sessions
at session (/Users/yoli/www/course-tracker/node_modules/express-session/index.js:200:12)
at Layer.handle [as handle_request] (/Users/yoli/www/course-tracker/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:317:13)
at /Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:335:12)
at next (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:275:10)
at urlencodedParser (/Users/yoli/www/course-tracker/node_modules/body-parser/lib/types/urlencoded.js:91:7)
at Layer.handle [as handle_request] (/Users/yoli/www/course-tracker/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:317:13)
at /Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:335:12)
at next (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:275:10)
at jsonParser (/Users/yoli/www/course-tracker/node_modules/body-parser/lib/types/json.js:110:7)
at Layer.handle [as handle_request] (/Users/yoli/www/course-tracker/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:317:13)
at /Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:284:7
Error: secret option required for sessions
at session (/Users/yoli/www/course-tracker/node_modules/express-session/index.js:200:12)
at Layer.handle [as handle_request] (/Users/yoli/www/course-tracker/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:317:13)
at /Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:335:12)
at next (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:275:10)
at urlencodedParser (/Users/yoli/www/course-tracker/node_modules/body-parser/lib/types/urlencoded.js:91:7)
at Layer.handle [as handle_request] (/Users/yoli/www/course-tracker/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:317:13)
at /Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:335:12)
at next (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:275:10)
at jsonParser (/Users/yoli/www/course-tracker/node_modules/body-parser/lib/types/json.js:110:7)
at Layer.handle [as handle_request] (/Users/yoli/www/course-tracker/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:317:13)
at /Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:284:7
Error: secret option required for sessions
at session (/Users/yoli/www/course-tracker/node_modules/express-session/index.js:200:12)
at Layer.handle [as handle_request] (/Users/yoli/www/course-tracker/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:317:13)
at /Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:335:12)
at next (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:275:10)
at urlencodedParser (/Users/yoli/www/course-tracker/node_modules/body-parser/lib/types/urlencoded.js:91:7)
at Layer.handle [as handle_request] (/Users/yoli/www/course-tracker/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:317:13)
at /Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:335:12)
at next (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:275:10)
at jsonParser (/Users/yoli/www/course-tracker/node_modules/body-parser/lib/types/json.js:110:7)
at Layer.handle [as handle_request] (/Users/yoli/www/course-tracker/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:317:13)
at /Users/yoli/www/course-tracker/node_modules/express/lib/router/index.js:284:7
Unable to check if endpoints are working with new shish-kebab-case changes because of the error.
Received SECRET_SESSION
key. Was able to move forward and did not have error/issue stated above after the fix. Thank you @emmebravo for the help.
All URI based paths (browser paths) should be shish-kebab-case not camelCase. This includes path in the react-router routing and in the server.