1 year ago
#375492
Amador
Error 500 using gin with simple GET in golang deployed service
Something rare is happening, the code running locally with no problems, and even run with no problems in the server when I call it using "go main.go", but after build and set the systemctl service it's throwing an error 500:
/home/user/go/pkg/mod/github.com/gin-gonic/gin@v1.7.7/gin.g
(Engine).ServeHTTP: engine.handleHTTPRequest(c)
/usr/local/go/src/net/http/server.go:2879 (0x6663da)
serverHandler.ServeHTTP: handler.ServeHTTP(rw, req)
/usr/local/go/src/net/http/server.go:1930 (0x661a87)
(conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req)
/usr/local/go/src/runtime/asm amd64.s:1581 (0x465200)
goexit: BYTE $0x90 // NOP
[GIN] 2022/04/05 - 01:16:51 | 500 | 9.701693ms | IP |
I'm using gin to handle http requests, this is a simple GET request:
func getAllTips(c *gin.Context) {
result := findAllTips()
c.IndentedJSON(200, result) }
called from main.go like this:
r.GET("/tips/", getAllTips)
r.GET("/tips/random", getRandomTip)
Does anyone knows how I can resolve this problem? Thank you all
linux
go
systemctl
0 Answers
Your Answer