osctrl
osctrl copied to clipboard
Getting query results in osctrl-admin results in panic error
Hello
I have set up osctrl-tls and osctrl-admin and enrolled a node.
I can issue a new query on the node that I added, and I can see in the logs from osctrl-tls that the query is executed and the results are comming in, however when I try to see the results in octrl-admin I get the following error:
GET /json/query/query_{id} HTTP/1.1
| Host: osctrl
| Accept: application/json, text/javascript, */*; q=0.01
| Accept-Encoding: gzip, deflate, br
| Accept-Language: en-US,en;q=0.5
| Cookie: osctrl-admin-session={cookie}
| Referer: https://osctrl/query/{id}/logs/query_{id}
| Sec-Fetch-Dest: empty
| Sec-Fetch-Mode: cors
| Sec-Fetch-Site: same-origin
| User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/115.0
| X-Forwarded-For: 192.168.0.3
| X-Forwarded-Host: osctrl
| X-Forwarded-Port: 443
| X-Forwarded-Proto: https
| X-Forwarded-Server: b09ba8aeb137
| X-Real-Ip: 192.168.0.3
| X-Requested-With: XMLHttpRequest
|
|
| ---------------- No Body
| ---------------- end
|
| server.go:3214: http: panic serving 192.168.1.90:45224: runtime error: invalid memory address or nil pointer dereference
| goroutine 2447 [running]:
| net/http.(*conn).serve.func1()
| /opt/hostedtoolcache/go/1.21.3/x64/src/net/http/server.go:1868 +0xb9
| panic({0x118f1e0?, 0x1fa76e0?})
| /opt/hostedtoolcache/go/1.21.3/x64/src/runtime/panic.go:920 +0x270
| github.com/jmpsec/osctrl/logging.(*LoggerDB).QueryLogs(0x0, {0xc000700150, 0x26})
| /home/runner/work/osctrl/osctrl/logging/db.go:190 +0x8a
| github.com/jmpsec/osctrl/admin/handlers.(*HandlersAdmin).JSONQueryLogsHandler(0xc00069e5b0, {0x1791790, 0xc000a9a620}, 0xc0006ad100)
| /home/runner/work/osctrl/osctrl/admin/handlers/json-logs.go:194 +0x245
| net/http.HandlerFunc.ServeHTTP(0xc0006ad000?, {0x1791790?, 0xc000a9a620?}, 0xc00010ef00?)
| /opt/hostedtoolcache/go/1.21.3/x64/src/net/http/server.go:2136 +0x29
| main.osctrlAdminService.handlerAuthCheck.func50({0x1791790, 0xc000a9a620}, 0xc0006ad000?)
| /home/runner/work/osctrl/osctrl/admin/auth.go:46 +0x3fa
| net/http.HandlerFunc.ServeHTTP(0xc0006acf00?, {0x1791790?, 0xc000a9a620?}, 0x7f725c6c8260?)
| /opt/hostedtoolcache/go/1.21.3/x64/src/net/http/server.go:2136 +0x29
| github.com/gorilla/mux.(*Router).ServeHTTP(0xc00063a000, {0x1791790, 0xc000a9a620}, 0xc0000b8c00)
| /home/runner/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:212 +0x1c5
| net/http.serverHandler.ServeHTTP({0xc00088a780?}, {0x1791790?, 0xc000a9a620?}, 0x6?)
| /opt/hostedtoolcache/go/1.21.3/x64/src/net/http/server.go:2938 +0x8e
| net/http.(*conn).serve(0xc0005a43f0, {0x1793620, 0xc00072ee70})
| /opt/hostedtoolcache/go/1.21.3/x64/src/net/http/server.go:2009 +0x5f4
| created by net/http.(*Server).Serve in goroutine 1
| /opt/hostedtoolcache/go/1.21.3/x64/src/net/http/server.go:3086 +0x5cb
| http-utils.go:107: ---------------- request