codingchili/kibana-mithril

Cannot Find jsonwebtoken

jamesspi opened this issue · 6 comments

Hi @codingchili

I'm trying to build on a Centos 6 server. I can run npm install without issue, however, when I try to run mocha, I get the following:

Error: Cannot find module 'jsonwebtoken'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/root/kibana/kbn-authentication-plugin/src/authentication/auth.js:7:13)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/root/kibana/kbn-authentication-plugin/src/api/api.js:11:24)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/root/kibana/kbn-authentication-plugin/test/api/api.js:10:13)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at /usr/lib/node_modules/mocha/lib/mocha.js:231:27
at Array.forEach (native)
at Mocha.loadFiles (/usr/lib/node_modules/mocha/lib/mocha.js:228:14)
at Mocha.run (/usr/lib/node_modules/mocha/lib/mocha.js:514:10)
at Object. (/usr/lib/node_modules/mocha/bin/_mocha:359:16)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:383:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:496:3

It's puzzling because the jsonwebtoken module is present in the node_modules directory.

Any ideas?

Thanks!
James

Hello!

Puzzling indeed.

I'm no node expert, but I would try this

  1. delete node_modules and run npm install again.
  2. run npm update?
  3. check if the module is visible using npm list
  4. whats your working dir? (should be /root/kibana/kbn-authentication-plugin)
  5. whats your node version? whats your mocha version?

At least try step 1 & 2 and let me know your result. Then I will look into reproducing it.

I'm seeing lots of build issues for node projects. Especially with native modules, like this project.

Thanks for submitting an issue!

Hey @codingchili,

I had been trying for hours, to no avail!

Removed node_modules, ran updates, ran default centos versions of node and npm, tried non standard versions etc... this is as far as I get :/

Module is indeed visible with npm list, and my working directory is also correct.

Last test was with node 9.0.0 and npm 1.3.6.

Thanks,
James

Ok, so, I managed to get it compiled and installed!

However, I cannot login. It keeps going back to the login page after I enter the credentials and token code.

Any idea? this is currently behind a reverse proxy.

Thanks!
James

How did you solve the first issue?
Anything in the logs?
Could you check network requests in your browser?

  • any redirects?
  • whats the response from the authentication call?
    Have you tested the reverse proxy without the plugin?

I used about 4 different versions of npm till I found one that worked!

Yes actually, found this:

2017/11/14 13:49:17 [error] 4707#0: *9969 connect() failed (111: Connection refused) while connecting to upstream, client: x.x.x.x, server: example.com, request: "POST /login HTTP/1.1", upstream: "http://[::1]:5601/login", host: "example.com", referrer: "https://example.com/login"

I've been using the RP for quite a while without issue (using nginx basic auth), just wanted to test this plugin.

Also - maybe you should add a note to the readme. I installed x-pack and then applied a free license. By default x-pack creates a route for /login already - so kibana complains about the conflicting routes on startup. I had to comment out the routes that the x-pack plugin creates before getting to this point.

Thanks,
James

where does 'example.com' come from?
could you make sure the login api is listening on ::1 ?
is that the log from the proxy or kibana?

Have not seen this issue before, but I have also not used either x-pack nor a reverse proxy with kibana.

Regards