API-Browser not workling

Heyo,

I know this comes a little late for a Graylog cluster that is running for almost two years now, but for some reason, our API-browser is broken since the beginning :smiley:

I was never able to fix it and gave up after a while, since I knew the API from the back of my head after working with it some time. But now others teams and departments from my company came to know that we have some of our data available for easy pickup via a REST-API. So I would like to have it working.

Maybe somebody can help me.
The interface itself renders fine. The problem is, the Elements cannot be opened. They simply jiggle a bit but don’t open. If you select the raw option, the correct swagger definition JSON gets returned. See this gif:

The console output is stating a few errors and two warnings:

[ERROR] The HTML-encoding was not specified. This page [...]. || api-browser
[WARN] no zlib library || shred.bundle.js:1726:3
[WARN] no iconv library || shred.bundle.js:1734:3
[INFO] Manage stream alarm callback histories || swagger-ui.js:1438:7
[INFO] Manage alarm callbacks (aka alert notifications) || swagger-ui.js:1438:7
[INFO] Manage stream alert conditions || swagger-ui.js:1438:7
[INFO] Manage stream alerts for all streams || swagger-ui.js:1438:7
[INFO] System information of all nodes in the cluster || swagger-ui.js:1438:7
[INFO] Cluster-wide deflector handling || swagger-ui.js:1438:7
[...]
[INFO]User accounts || swagger-ui.js:1438:7
[INFO]Loaded SwaggerUI || api-browser:44:11
[ERROR] ReferenceError: error is not defined || swagger.js:308:15 

Having a look at the JavaScript file in the debugger and setting a breakpoint reveals a Server Response 500 to be the issue. It seems, that Graylog makes this request: GET https://graylog.dc.rewe.local/api/api-docs/cluster/{nodeId}/metrics and forgets to replace {nodeId} with the actual node ID of the server.
Looking further at the request reveals this GET https://graylog.dc.rewe.local/api/api-docs/system/inputs/{inputId}/extractors also returns with response code 500.
For some reason, my API-browser does not replace placeholders with actual values.

Did anybody experience the same issue and has a solution?

Greetings,
Philipp

PS: Even though I don’t think that it has to do with my configuration, here it is:

# Node-ID file contains a name like Prod01 or Test01
node_id_file = /etc/graylog/server/node-id
[...]
rest_listen_uri = http://127.0.0.1:12900/api/
rest_transport_uri = https://graylog.dc.rewe.local/api/
#rest_enable_cors = false
#rest_enable_gzip = false
web_listen_uri = http://127.0.0.1:9000/
#web_endpoint_uri =
web_enable_cors = true
web_enable_gzip = true

he @derPhlipsi

I know this problem too - when you have Graylog in a sub-directory ( http://nuci.lan/graylog/ )you are having the same issues.

Would you please be kind and create a bug issue on Github for that. The swagger version should be updated and this should work in any configuration.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.