Closed Miguel-Herrero closed 8 years ago
Did the following:
git checkout myAssignment7_i155
npm install
npm start
result below:
Error: Cannot find module 'boom'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (../Miguel-Herrero/university/lib/api/login.js:6:14)
You need to debug this yourself. Perhaps, you are rushing.
Slow down and build each piece of your application step by step.
At each step of building your application run tests and prove it works
How did you resolved this issue ?
@D34THWINGS release of next assignment (assignment7 update to ES6) will illustrate how to do this. Worked on it some today and hope to finish in next day or two.
Usually, this relates to hapi-auth-cookie 's strategy being registered to the correct hapi server connection.
Assuming you are using Glue and you have multiple connections (tls and non-tls). Check that the plugin which registers the auth-cookie strategy is assigned to the correct connection (ex. tls) versus just the general server object with no connection specified.
Sample manifest
internals.manifest = {
connections: [
{
host: 'localhost',
port: 0,
labels: ['web']
},
{
host: 'localhost',
port: 0,
labels: ['web-tls'],
tls: Config.tls
}
],
registrations: [
{
plugin: './auth-dev',
options: {
select: ['web-tls']
}
},
{
plugin: './cookie-auth',
options: {
select: ['web-tls']
}
},
{
plugin: 'hapi-auth-cookie',
}
]
};
Assuming the above cookie-auth plugin has the:
server.auth.strategy(name, scheme, [mode], [options])
logic inside it.
The server object must be pointing to one of the server connections above.
Otherwise, you get the below message:
Error: Request interface decoration already defined: cookieAuth
.
If you dropped the below configuration from the cookie-auth plugins options. It creates the error message.
options: {
select: ['web-tls']
}
The above reflects how I usually create this error and trouble shoot it. Have not looked much at @Miguel-Herrero 's project for the reasons mentioned above.
@zoe-1 Thanks for your time and for the explanation, I was effectively registering the strategy on global server, switching it to a per connection registration worked perfectly !
@D34THWINGS Glad it worked for you :)
I have followed the Assignments successfully (updating the code to use latest versions) until the one with hapi-auth-cookie. I cannot make it work, because when I start the server (
npm start
), this error appears:Theoretically I know what it means, but I don't know where I am redecorating the
cookieAuth
in my code.I would be very thankful if anybody could review my fork and give me some advice as to where to look… Thank you in advance.
(Note: previous assignment successfully passed tests with 100 % coverage)