Access to HTTP Stork provoques: invalid memory address or nil pointer dereference message
Stork version: current, I cloned stork today 27/08/2024 OS: Openbsd 7.5
I start the server with
# /usr/local/stork/backend/cmd/stork-server/stork-server --rest-static-files-dir /usr/local/stork/webui/dist/stork/ --db-host=/tmp -u mystorkuser -d mystorkdatabase
I can see these messages
INFO[2024-08-27 23:18:38] connection.go:90 Checking connection to database
INFO[2024-08-27 23:18:38] connection.go:155 Connected to database /tmp/.s.PGSQL.5432
INFO[2024-08-27 23:18:38] connection.go:184 Database is up-to-date version="59"
...
INFO[2024-08-27 23:18:38] eventcenter.go:155 Event 'started Stork Server'
INFO[2024-08-27 23:18:38] main.go:68 Starting Stork Server, version 1.18.0, build date 2024-08-27 20:41
INFO[2024-08-27 23:18:38] restservice.go:514 Started serving Stork Server address="http://0.0.0.0:8080"
But then when Stork is accessed through HTTP I see this, and it doesn't sound good
INFO[2024-08-27 23:22:20] middleware.go:92 HTTP request incoming method="GET" path="/api/apps/communication-issues" remote="192.168.1.7:58871"
2024/08/27 23:22:20 http: panic serving 192.168.1.7:58871: runtime error: invalid memory address or nil pointer dereference
goroutine 75 [running]:
net/http.(*conn).serve.func1()
/usr/local/go/src/net/http/server.go:1898 +0xbe
panic({0xf0f7e0?, 0x1989620?})
/usr/local/go/src/runtime/panic.go:770 +0x132
isc.org/stork/server/restservice.(*RestAPI).appToRestAPI(0xc000020000, 0xc000153348)
/usr/local/stork/backend/server/restservice/machines.go:1035 +0x840
isc.org/stork/server/restservice.(*RestAPI).GetAppsWithCommunicationIssues(0xc000020000, {0xc0007e8510?, 0xe83ba0?}, {0x124a620?})
/usr/local/stork/backend/server/restservice/machines.go:1199 +0x275
isc.org/stork/server/gen/restapi.HandlerAPI.func27({0x8?}, {0xe82360?, 0xc000b527a0?})
/usr/local/stork/backend/server/gen/restapi/configure_stork.go:502 +0x8f
isc.org/stork/server/gen/restapi/operations/services.GetAppsWithCommunicationIssuesHandlerFunc.Handle(0xc000b78300?, {0xc0005786c0?}, {0xe82360?, 0xc000b527a0?})
/usr/local/stork/backend/server/gen/restapi/operations/services/get_apps_with_communication_issues.go:19 +0x29
isc.org/stork/server/gen/restapi/operations/services.(*GetAppsWithCommunicationIssues).ServeHTTP(0xc000ccf590, {0x12569b0, 0xc0007e8480}, 0xc0005786c0)
/usr/local/stork/backend/server/gen/restapi/operations/services/get_apps_with_communication_issues.go:68 +0x284
github.com/go-openapi/runtime/middleware.(*Context).RoutesHandler.NewOperationExecutor.func1({0x12569b0, 0xc0007e8480}, 0xc0005786c0)
/usr/local/stork/tools/golang/gopath/pkg/mod/github.com/go-openapi/runtime@v0.28.0/middleware/operation.go:28 +0x53
net/http.HandlerFunc.ServeHTTP(0xc000578360?, {0x12569b0?, 0xc0007e8480?}, 0xc000f71048?)
/usr/local/go/src/net/http/server.go:2166 +0x29
isc.org/stork/server/restservice.(*RestAPI).InnerMiddleware-fm.(*RestAPI).InnerMiddleware.(*SessionMgr).SessionMiddleware.(*SessionManager).LoadAndSave.func1({0x1256980, 0xc000022630
/usr/local/stork/tools/golang/gopath/pkg/mod/github.com/alexedwards/scs/v2@v2.8.0/session.go:156 +0x162
net/http.HandlerFunc.ServeHTTP(0xc000b78300?, {0x1256980?, 0xc000022630?}, 0xc000f6eff0?)
/usr/local/go/src/net/http/server.go:2166 +0x29
github.com/go-openapi/runtime/middleware.NewRouter.func1({0x1256980, 0xc000022630}, 0xc000219c20)
/usr/local/stork/tools/golang/gopath/pkg/mod/github.com/go-openapi/runtime@v0.28.0/middleware/router.go:80 +0x257
net/http.HandlerFunc.ServeHTTP(0xc000db40c4?, {0x1256980?, 0xc000022630?}, 0xc0007d3f50?)
/usr/local/go/src/net/http/server.go:2166 +0x29
github.com/go-openapi/runtime/middleware.Redoc.serveUI.func1({0x1256980, 0xc000022630}, 0xc000219c20)
/usr/local/stork/tools/golang/gopath/pkg/mod/github.com/go-openapi/runtime@v0.28.0/middleware/ui_options.go:164 +0xda
net/http.HandlerFunc.ServeHTTP(0xc000db40c4?, {0x1256980?, 0xc000022630?}, 0x1a?)
/usr/local/go/src/net/http/server.go:2166 +0x29
github.com/go-openapi/runtime/middleware.Spec.func1({0x1256980, 0xc000022630}, 0xc000219c20)
/usr/local/stork/tools/golang/gopath/pkg/mod/github.com/go-openapi/runtime@v0.28.0/middleware/spec.go:72 +0x1b1
net/http.HandlerFunc.ServeHTTP(0xc000db40c4?, {0x1256980?, 0xc000022630?}, 0xc000255dc0?)
/usr/local/go/src/net/http/server.go:2166 +0x29
isc.org/stork/server/restservice.(*RestAPI).GlobalMiddleware.fileServerMiddleware.func1({0x1256980, 0xc000022630}, 0xc000219c20)
/usr/local/stork/backend/server/restservice/middleware.go:116 +0xe4
net/http.HandlerFunc.ServeHTTP(0xc000db40c4?, {0x1256980?, 0xc000022630?}, 0x6c0160?)
/usr/local/go/src/net/http/server.go:2166 +0x29
isc.org/stork/server/restservice.(*RestAPI).GlobalMiddleware.agentInstallerMiddleware.func2({0x1256980, 0xc000022630}, 0xc000219c20)
/usr/local/stork/backend/server/restservice/middleware.go:282 +0x32d
net/http.HandlerFunc.ServeHTTP(0xc000db40c4?, {0x1256980?, 0xc000022630?}, 0x461f7e?)
/usr/local/go/src/net/http/server.go:2166 +0x29
isc.org/stork/server/restservice.(*RestAPI).GlobalMiddleware.sseMiddleware.func3({0x1256980, 0xc000022630}, 0xc000219c20)
/usr/local/stork/backend/server/restservice/middleware.go:156 +0xac
net/http.HandlerFunc.ServeHTTP(0xc000995098?, {0x1256980?, 0xc000022630?}, 0xc000f6f7e8?)
/usr/local/go/src/net/http/server.go:2166 +0x29
isc.org/stork/server/restservice.metricsMiddleware.func2({0x1256980?, 0xc000022630?}, 0x4dd30f?)
/usr/local/stork/backend/server/restservice/middleware.go:307 +0x6c
net/http.HandlerFunc.ServeHTTP(0xf19540?, {0x1256980?, 0xc000022630?}, 0x6?)
/usr/local/go/src/net/http/server.go:2166 +0x29
isc.org/stork/server/restservice.(*RestAPI).GlobalMiddleware.loggingMiddleware.func5({0x1257040, 0xc000382540}, 0xc000219c20)
/usr/local/stork/backend/server/restservice/middleware.go:96 +0x35f
net/http.HandlerFunc.ServeHTTP(0x4706b9?, {0x1257040?, 0xc000382540?}, 0xc000071b68?)
/usr/local/go/src/net/http/server.go:2166 +0x29
net/http.serverHandler.ServeHTTP({0xc0007d3dd0?}, {0x1257040?, 0xc000382540?}, 0x6?)
/usr/local/go/src/net/http/server.go:3137 +0x8e
net/http.(*conn).serve(0xc0005fa510, {0x12583f0, 0xc00061a180})
/usr/local/go/src/net/http/server.go:2039 +0x5e8
created by net/http.(*Server).Serve in goroutine 1
/usr/local/go/src/net/http/server.go:3285 +0x4b4
From a GUI point of view I don't see something abnormal.
I just have one unauthorised machine asking to join. I'm not sure but after I authorised the machine, that panic message doesn't display anymore.
Edited by mikygee