Closed fredycc closed 8 years ago
@fredycc off the top of my head I have a gitignored json file that contains the secret. You need to create that file for this to work.
I can double check the exact file structure later if you like.
I'd appreciate it greatly if you could upload the file.
Thank you.
It looks like I have deleted the file. I have looked over the code to work out the format. The config should look like this:
{
"auth": {
"secret": "YOUR_SECRET_HERE"
}
}
Thanks, I'll try tonight.
Regards
This error appears when I execute the test for serverless.
I need a file with a special configuration for token.js? ->config = require('../config');
Serverless: POST /sessions/create (λ: session-create) Serverless: The first request might take a few extra seconds Serverless: Error while loading session-create [ 'Error: Cannot find module \'../config\'', 'at Function.Module._resolveFilename (module.js:325:15)', 'at Function.Module._load (module.js:276:25)', 'at Module.require (module.js:353:17)', 'at require (internal/module.js:12:17)', 'at Object. (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\auth\lib\token.js:3:14)',
'at Module._compile (module.js:409:26)',
'at Object.Module._extensions..js (module.js:416:10)',
'at Module.load (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\coffee-script\lib\coffee-script\register.js:45:36)',
'at Function.Module._load (module.js:300:12)',
'at Module.require (module.js:353:17)',
'at require (internal/module.js:12:17)',
'at Object. (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\auth\sessions\create\handler.js:3:13)',
'at Module._compile (module.js:409:26)',
'at Object.Module._extensions..js (module.js:416:10)',
'at Module.load (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\coffee-script\lib\coffee-script\register.js:45:36)',
'at Function.Module._load (module.js:300:12)',
'at Module.require (module.js:353:17)',
'at require (internal/module.js:12:17)',
'at Object.createHandler (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\src\functionHelper.js:34:21)' ]
Serverless: Replying error in handler
Serverless: Running Authorization function for post /foo (λ: authorization) Debug: internal, implementation, error Error: Internal Server Error at Object.authenticate (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\src\createAuthScheme.js:68:27) at C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\auth.js:324:34 at [object Object].internals.Protect.run.finish [as run](C:UsersFredy CaballeroDownloadsexpress-to-aws-lambda-4-authenticationserverlessv0.5node_modulesserverless-offlinenode_moduleshapilibprotect.js:64:5) at [object Object].execute (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\auth.js:320:30) at [object Object].authenticate (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\auth.js:306:21) at [object Object].internals.Auth.test.internals.Auth._authenticate (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\auth.js:214:19) at internals.Auth.test.internals.Auth.authenticate (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\auth.js:202:17) at each (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\request.js:383:16) at iterate (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\node_modules\items\lib\index.js:36:13) at done (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\node_modules\items\lib\index.js:28:25) at internals.state.next (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\route.js:350:16) at each (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\request.js:383:16) at iterate (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\node_modules\items\lib\index.js:36:13) at Object.exports.serial (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\node_modules\items\lib\index.js:39:9) at [object Object].internals.Request.internals.Request._execute.internals.Request._lifecycle.each [as _lifecycle](C:UsersFredy CaballeroDownloadsexpress-to-aws-lambda-4-authenticationserverlessv0.5node_modulesserverless-offlinenode_moduleshapilibrequest.js:386:11) at [object Object].internals.Request.internals.Request._execute (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\request.js:301:21) at Domain. (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\connection.js:261:25)
at Domain.run (domain.js:228:14)
at [object Object].internals.Protect.run.internals.Protect.enter (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\protect.js:80:17)
at Server. (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\connection.js:259:30)
at emitTwo (events.js:87:13)
at Server.emit (events.js:172:7)
at HTTPParser.parserOnIncoming as onIncoming
at HTTPParser.parserOnHeadersComplete (_http_common.js:103:23)
Serverless: Running Authorization function for get /foo/:id (λ: authorization) Debug: internal, implementation, error Error: Internal Server Error at Object.authenticate (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\src\createAuthScheme.js:68:27) at C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\auth.js:324:34 at [object Object].internals.Protect.run.finish [as run](C:UsersFredy CaballeroDownloadsexpress-to-aws-lambda-4-authenticationserverlessv0.5node_modulesserverless-offlinenode_moduleshapilibprotect.js:64:5) at [object Object].execute (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\auth.js:320:30) at [object Object].authenticate (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\auth.js:306:21) at [object Object].internals.Auth.test.internals.Auth._authenticate (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\auth.js:214:19) at internals.Auth.test.internals.Auth.authenticate (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\auth.js:202:17) at each (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\request.js:383:16) at iterate (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\node_modules\items\lib\index.js:36:13) at done (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\node_modules\items\lib\index.js:28:25) at internals.state.next (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\route.js:350:16) at each (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\request.js:383:16) at iterate (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\node_modules\items\lib\index.js:36:13) at Object.exports.serial (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\node_modules\items\lib\index.js:39:9) at [object Object].internals.Request.internals.Request._execute.internals.Request._lifecycle.each [as _lifecycle](C:UsersFredy CaballeroDownloadsexpress-to-aws-lambda-4-authenticationserverlessv0.5node_modulesserverless-offlinenode_moduleshapilibrequest.js:386:11) at [object Object].internals.Request.internals.Request._execute (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\request.js:301:21) at Domain. (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\connection.js:261:25)
at Domain.run (domain.js:228:14)
at [object Object].internals.Protect.run.internals.Protect.enter (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\protect.js:80:17)
at Server. (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\connection.js:259:30)
at emitTwo (events.js:87:13)
at Server.emit (events.js:172:7)
at HTTPParser.parserOnIncoming as onIncoming
at HTTPParser.parserOnHeadersComplete (_http_common.js:103:23)
Serverless: Running Authorization function for put /foo/:id (λ: authorization) Debug: internal, implementation, error Error: Internal Server Error at Object.authenticate (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\src\createAuthScheme.js:68:27) at C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\auth.js:324:34 at [object Object].internals.Protect.run.finish [as run](C:UsersFredy CaballeroDownloadsexpress-to-aws-lambda-4-authenticationserverlessv0.5node_modulesserverless-offlinenode_moduleshapilibprotect.js:64:5) at [object Object].execute (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\auth.js:320:30) at [object Object].authenticate (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\auth.js:306:21) at [object Object].internals.Auth.test.internals.Auth._authenticate (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\auth.js:214:19) at internals.Auth.test.internals.Auth.authenticate (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\auth.js:202:17) at each (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\request.js:383:16) at iterate (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\node_modules\items\lib\index.js:36:13) at done (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\node_modules\items\lib\index.js:28:25) at internals.state.next (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\route.js:350:16) at each (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\request.js:383:16) at iterate (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\node_modules\items\lib\index.js:36:13) at Object.exports.serial (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\node_modules\items\lib\index.js:39:9) at [object Object].internals.Request.internals.Request._execute.internals.Request._lifecycle.each [as _lifecycle](C:UsersFredy CaballeroDownloadsexpress-to-aws-lambda-4-authenticationserverlessv0.5node_modulesserverless-offlinenode_moduleshapilibrequest.js:386:11) at [object Object].internals.Request.internals.Request._execute (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\request.js:301:21) at Domain. (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\connection.js:261:25)
at Domain.run (domain.js:228:14)
at [object Object].internals.Protect.run.internals.Protect.enter (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\protect.js:80:17)
at Server. (C:\Users\Fredy Caballero\Downloads\express-to-aws-lambda-4-authentication\serverless\v0.5\node_modules\serverless-offline\node_modules\hapi\lib\connection.js:259:30)
at emitTwo (events.js:87:13)
at Server.emit (events.js:172:7)
at HTTPParser.parserOnIncoming as onIncoming
at HTTPParser.parserOnHeadersComplete (_http_common.js:103:23)
Thanks in advanced.