Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osctrl-api is not working #549

Closed
zhuoyuan-liu opened this issue Oct 25, 2024 · 2 comments
Closed

osctrl-api is not working #549

zhuoyuan-liu opened this issue Oct 25, 2024 · 2 comments
Assignees
Labels
🐛 bug Something isn't working osctrl-api osctrl-api related changes

Comments

@zhuoyuan-liu
Copy link
Contributor

It seems that osctrl-api is broken after this change: #507

I got the following error when calling QueriesRunHandler


2024/10/25 11:37:37 http: panic serving 127.0.0.1:60460: interface conversion: interface {} is nil, not handlers.contextValue |  
-- | --
  |   | 2024-10-25 13:37:37.165 | goroutine 83 [running]: |  
  |   | 2024-10-25 13:37:37.165 | net/http.(*conn).serve.func1() |  
  |   | 2024-10-25 13:37:37.165 | net/http/server.go:1947 +0xb0 |  
  |   | 2024-10-25 13:37:37.165 | panic({0x904cc0?, 0x4000648990?}) |  
  |   | 2024-10-25 13:37:37.165 | runtime/panic.go:785 +0x124 |  
  |   | 2024-10-25 13:37:37.165 | github.com/jmpsec/osctrl/api/handlers.(*HandlersApi).QueriesRunHandler(0x400045df00, {0xc6b0d8, 0x40000e41c0}, 0x4000412000) |  
  |   | 2024-10-25 13:37:37.165 | github.com/jmpsec/osctrl/api/[email protected]/queries.go:87 +0x12e8 |  
  |   | 2024-10-25 13:37:37.165 | net/http.HandlerFunc.ServeHTTP(0x400047e000?, {0xc6b0d8?, 0x40000e41c0?}, 0xc5f2a0?) |  
  |   | 2024-10-25 13:37:37.165 | net/http/server.go:2220 +0x38 |  
  |   | 2024-10-25 13:37:37.165 | main.osctrlAPIService.handlerAuthCheck.func22({0xc6b0d8, 0x40000e41c0}, 0x400047e000) |  
  |   | 2024-10-25 13:37:37.165 | osctrl/api/auth.go:58 +0x364 |  
  |   | 2024-10-25 13:37:37.165 | net/http.HandlerFunc.ServeHTTP(0x40000e40e0?, {0xc6b0d8?, 0x40000e41c0?}, 0x40006e5b10?) |  
  |   | 2024-10-25 13:37:37.165 | net/http/server.go:2220 +0x38 |  
  |   | 2024-10-25 13:37:37.165 | net/http.(*ServeMux).ServeHTTP(0x10?, {0xc6b0d8, 0x40000e41c0}, 0x400047e000) |  
  |   | 2024-10-25 13:37:37.165 | net/http/server.go:2747 +0x1b4 |  
  |   | 2024-10-25 13:37:37.165 | net/http.serverHandler.ServeHTTP({0xc676e0?}, {0xc6b0d8?, 0x40000e41c0?}, 0x6?) |  
  |   | 2024-10-25 13:37:37.165 | net/http/server.go:3210 +0xbc |  
  |   | 2024-10-25 13:37:37.165 | net/http.(*conn).serve(0x40000f2480, {0xc6c9d0, 0x40007aab40}) |  
  |   | 2024-10-25 13:37:37.165 | net/http/server.go:2092 +0x4fc |  
  |   | 2024-10-25 13:37:37.165 | created by net/http.(*Server).Serve in goroutine 1 |  
  |   | 2024-10-25 13:37:37.165 | net/http/server.go:3360 +0x3dc

I went through some recent changes and found that the osctrl-api is in a bad position, where no components are using it. osctrl-admin and osctrl-cli are calling database directly. Is there any plan to reduce the code duplication and make sure all the API requests would go through the osctrl-api? It also reduces the risk for direct access to the database.

Also, for organizing the code, I would suggest that we move all the binary main.go to /cmd/osctrl-components and keep only one go.mod file. It helps us find all implementation and references.

@javuto
Copy link
Collaborator

javuto commented Nov 1, 2024

Just merged a fix for the osctrl-api crash, along some other improvements.

The plan is to replace osctrl-admin with a modern UI that utilizes the osctrl-api under the hood, but frontend work takes time.

@javuto
Copy link
Collaborator

javuto commented Nov 15, 2024

Closing this issue for now as he osctrl-api is working again. Feel free to reopen if you encounter the same or new issues. Thanks!

@javuto javuto closed this as completed Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working osctrl-api osctrl-api related changes
Projects
None yet
Development

No branches or pull requests

2 participants