Open xavierhardy opened 8 years ago
Node version v6.9.1, using package version 1.0.0
I think know the reason for your problem. graylog-dashboard.js forces the URL to have :12900 in it (see line 92)
// Make sure we have a port (default REST API port is 12900) if (!/:\d+$/.test(config.serverURL)) config.serverURL += ':12900'; // Make sure config.serverURL has a trailing slash. (computers.) if (config.serverURL[config.serverURL.length - 1] !== '/') config.serverURL += '/'; return config });
This is a problem since I (and you probably too) have the Graylog API available at the URL https://graylog.example.com/api/. This can be seen when you add a little debug to the Error message:
Error: Could not get streams. -->url: https://graylog.example.com/api/:12900/streams -->response:
Error: Bad status code: 404 Not Found [object Object] at request.getAsync.then (/usr/lib/node_modules/graylog-cli-dashboard/lib/graylog-api.js:99:13) at tryCatcher (/usr/lib/node_modules/graylog-cli-dashboard/node_modules/bluebird/js/release util.js:16:23)
So the fix for this is to simply comment out line 92 :)
Or add port 443 to your path. Thanks, I'll see what I can do to make this simpler.
On Jan 12, 2017 6:34 AM, "Philipp Ruland" notifications@github.com wrote:
I think know the reason for your problem. graylog-dashboard.js forces the URL to have :12900 in it (see line 92)
// Make sure we have a port (default REST API port is 12900) if (!/:\d+$/.test(config.serverURL)) config.serverURL += ':12900'; // Make sure config.serverURL has a trailing slash. (computers.) if (config.serverURL[config.serverURL.length - 1] !== '/') config.serverURL += '/'; return config });
This is a problem since I (and you probably too) have the Graylog API available at the URL https://graylog.example.com/api/. This can be seen when you add a little debug to the Error message:
Error: Could not get streams. -->url: https://graylog.example.com/api/:12900/streams -->response:
Error: Bad status code: 404 Not Found [object Object] at request.getAsync.then (/usr/lib/node_modules/graylog-cli-dashboard/lib/ graylog-api.js:99:13) at tryCatcher (/usr/lib/node_modules/graylog-cli-dashboard/node_modules/bluebird/js/release util.js:16:23)
So the fix for this is to simply comment out line 92 :)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Graylog2/cli-dashboard/issues/25#issuecomment-272152362, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJFP7Uce-Lt0EUxeKLf7dHm-C47F7Z0ks5rRh3TgaJpZM4KydN9 .
Well, that didn't fix it for me. It surprised me too, because the if statement is searching for :
Oh yeah; it's not assuming a path at all... the regex is looking for :\d+$
, aka end of string. Would be smarter if it just parsed the url.
It appears there are two configuration options for the API now as of 2.1; separate port, or same port separated by path.
I won't have time for a bit to work on this; would be happy to accept a PR. To be honest, just removing this attempt to be smart would be fine, so long as there's a better error message for when we 404 (something like "is this API URL (${apiURL}) correct?"
)
I'll make a proper fix and open a PR :)
@DerPhlipsi I don't think it is the problem with the server configuration, because if it was then the OP would get a failure on the very first api call made (get /streams), and it would probably be a connection failure. A 404 response means that the connection has been made successfully, and the graylog api server is explicitly returning a 404 for some reason.
@xavierhardy : It's worth running a reverse proxy (e.g. nginx) in front of graylog to find out exactly what the api call is which is failing, and if possible to find out the response details. It might (or might not) be the same problem I've reported in #28.
When opening a valid stream (I get another error when using an invalid title), I get the following error. The dashboard is not even displayed.