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: Unknown handler: directory #22

Closed
nelsonic opened this issue Aug 14, 2015 · 7 comments
Closed

Error: Unknown handler: directory #22

nelsonic opened this issue Aug 14, 2015 · 7 comments
Labels

Comments

@nelsonic
Copy link
Member

We are using Hapi.js as our static server using the directory handler:

server.route( { method: 'GET', path: '/{param*}', handler: { directory: { path: Path.normalize(__dirname + '/') } } });

but when we attempt to upgrade to hapi v9.x we get:

Error: Unknown handler: directory

hapi-stack-trace

full stack trace:

/Users/n/code/learn-tdd/node_modules/hapi/node_modules/hoek/lib/index.js:723
    throw new Error(msgs.join(' ') || 'Unknown error');
          ^
Error: Unknown handler: directory
    at Object.exports.assert (/Users/n/code/learn-tdd/node_modules/hapi/node_modules/hoek/lib/index.js:723:11)
    at Object.exports.defaults (/Users/n/code/learn-tdd/node_modules/hapi/lib/handler.js:105:14)
    at new module.exports.internals.Route (/Users/n/code/learn-tdd/node_modules/hapi/lib/route.js:48:35)
    at internals.Connection._addRoute (/Users/n/code/learn-tdd/node_modules/hapi/lib/connection.js:359:17)
    at internals.Connection._route (/Users/n/code/learn-tdd/node_modules/hapi/lib/connection.js:351:18)
    at internals.Plugin._apply (/Users/n/code/learn-tdd/node_modules/hapi/lib/plugin.js:497:14)
    at internals.Plugin.route (/Users/n/code/learn-tdd/node_modules/hapi/lib/plugin.js:470:10)
    at Object.<anonymous> (/Users/n/code/learn-tdd/static-server.js:3:8)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
13 Aug 19:11:49 - [nodemon] app crashed - waiting for file changes before starting...
@nelsonic nelsonic added the bug label Aug 14, 2015
@nelsonic
Copy link
Member Author

Apparently we need to manually register the plugin in order to serve a directory now...
hapijs/hapi#2682 (comment) #lame 😕

@nelsonic
Copy link
Member Author

What's making you sad @baralex ?
How can we help? 🌈

@barbalex
Copy link

sorry for bugging, I added inert and the plugin call
thanks for a great tool

@nelsonic
Copy link
Member Author

@barbalex you are not "bugging" at all.
glad you like the tool(s).
Welcome to dwyl! :-)

@barbalex
Copy link

:-)

2015-09-16 15:05 GMT+02:00 Nelson [email protected]:

@barbalex https://github.com/barbalex you are not "bugging" at all.
glad you like the tool(s).
Welcome to dwyl https://github.com/dwyl! :-)


Reply to this email directly or view it on GitHub
#22 (comment).

@msmichellegar
Copy link

Just got this error and DWYL was the #1 result in my google search @nelsonic ;) 💯

Guess I'm finally going to figure out the new version of Hapi.

@nelsonic
Copy link
Member Author

nelsonic commented Dec 9, 2015

Gotta love SEO for random github issues. 😉
Glad you've got it working.

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

No branches or pull requests

3 participants