xinliangnote / go-gin-api

基于 Gin 进行模块化设计的 API 框架,封装了常用功能,使用简单,致力于进行快速的业务研发。比如,支持 cors 跨域、jwt 签名验证、zap 日志收集、panic 异常捕获、trace 链路追踪、prometheus 监控指标、swagger 文档生成、viper 配置文件解析、gorm 数据库组件、gormgen 代码生成工具、graphql 查询语言、errno 统一定义错误码、gRPC 的使用、cron 定时任务 等等。
https://www.yuque.com/xinliangnote/go-gin-api/ngc3x5
MIT License
5.61k stars 1.09k forks source link

错误码:10101 错误信息:内部服务器错误 #97

Open zhangduanya opened 1 year ago

zhangduanya commented 1 year ago

初始化安装之后返回登录显示 “错误码:10101 错误信息:内部服务器错误” image

后端日志:

{"level":"error","time":"2023-04-07 11:48:14","caller":"core/core.go:371","msg":"got panic","domain":"go-gin-api[fat]","panic":"runtime error: invalid memory address or nil pointer derefer ence","stack":"goroutine 60 [running]:\nruntime/debug.Stack(0xc0000186f8, 0xedcbe0, 0x3152430)\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x9f\ngithub.com/xinliangnote/go-gin-api/inte rnal/pkg/core.New.func2.1(0x199dc90, 0xc000010f08, 0xc0001a1b60, 0xc000460120, 0xc00040eb00, 0xc104027fa2748869, 0x31563732a, 0xc0003e7d50)\n\t/opt/repo/src/github.com/xinliangnote/go-gin- api/internal/pkg/core/core.go:370 +0x20d1\npanic(0xedcbe0, 0x3152430)\n\t/usr/local/go/src/runtime/panic.go:965 +0x1b9\ngithub.com/xinliangnote/go-gin-api/internal/services/admin.(service ).Detail(0xc00044ece0, 0x199dc90, 0xc0000ad248, 0xc00178d130, 0x0, 0x0, 0x0)\n\t/opt/repo/src/github.com/xinliangnote/go-gin-api/internal/services/admin/service_detail.go:47 +0x1f7\ngithub .com/xinliangnote/go-gin-api/internal/api/admin.(handler).Login.func1(0x199dc90, 0xc0000ad248)\n\t/opt/repo/src/github.com/xinliangnote/go-gin-api/internal/api/admin/func_login.go:56 +0x3 8c\ngithub.com/xinliangnote/go-gin-api/internal/pkg/core.wrapHandlers.func1(0xc00040eb00)\n\t/opt/repo/src/github.com/xinliangnote/go-gin-api/internal/pkg/core/core.go:212 +0xad\ngithub.co m/gin-gonic/gin.(Context).Next(...)\n\t/opt/repo/pkg/mod/github.com/gin-gonic/gin@v1.7.4/context.go:165\ngithub.com/xinliangnote/go-gin-api/internal/pkg/core.New.func3(0xc00040eb00)\n\t/o pt/repo/src/github.com/xinliangnote/go-gin-api/internal/pkg/core/core.go:541 +0x108\ngithub.com/gin-gonic/gin.(Context).Next(...)\n\t/opt/repo/pkg/mod/github.com/gin-gonic/gin@v1.7.4/cont ext.go:165\ngithub.com/xinliangnote/go-gin-api/internal/pkg/core.New.func2(0xc00040eb00)\n\t/opt/repo/src/github.com/xinliangnote/go-gin-api/internal/pkg/core/core.go:523 +0x250\ngithub.co m/gin-gonic/gin.(Context).Next(...)\n\t/opt/repo/pkg/mod/github.com/gin-gonic/gin@v1.7.4/context.go:165\ngithub.com/xinliangnote/go-gin-api/internal/pkg/core.New.func1(0xc00040eb00)\n\t/o pt/repo/src/github.com/xinliangnote/go-gin-api/internal/pkg/core/core.go:327 +0x67\ngithub.com/gin-gonic/gin.(Context).Next(...)\n\t/opt/repo/pkg/mod/github.com/gin-gonic/gin@v1.7.4/conte xt.go:165\ngithub.com/gin-gonic/gin.(Engine).handleHTTPRequest(0xc0002489c0, 0xc00040eb00)\n\t/opt/repo/pkg/mod/github.com/gin-gonic/gin@v1.7.4/gin.go:489 +0x2aa\ngithub.com/gin-gonic/gin .(Engine).ServeHTTP(0xc0002489c0, 0x19861b8, 0xc00042ad20, 0xc001827600)\n\t/opt/repo/pkg/mod/github.com/gin-gonic/gin@v1.7.4/gin.go:445 +0x15c\ngithub.com/xinliangnote/go-gin-api/interna l/pkg/core.(mux).ServeHTTP(0xc000010c10, 0x19861b8, 0xc00042ad20, 0xc001827600)\n\t/opt/repo/src/github.com/xinliangnote/go-gin-api/internal/pkg/core/core.go:232 +0x4c\nnet/http.serverHan dler.ServeHTTP(0xc00042a460, 0x19861b8, 0xc00042ad20, 0xc001827600)\n\t/usr/local/go/src/net/http/server.go:2868 +0xa3\nnet/http.(conn).serve(0xc00011a6e0, 0x1988c18, 0xc0001f7880)\n\t/us r/local/go/src/net/http/server.go:1933 +0x8cd\ncreated by net/http.(Server).Serve\n\t/usr/local/go/src/net/http/server.go:2994 +0x39b\n"} {"level":"error","time":"2023-04-07 11:48:14","caller":"alert/alert.go:21","msg":"Mail config error","domain":"go-gin-api[fat]"} {"level":"info","time":"2023-04-07 11:48:14","caller":"core/core.go:509","msg":"trace-log","domain":"go-gin-api[fat]","method":"POST","path":"/api/login","http_code":500,"business_code":10 101,"success":false,"cost_seconds":0.000834516,"trace_id":"093d611b2027c5a1a3cd","trace_info":{"trace_id":"093d611b2027c5a1a3cd","request":{"ttl":"un-limit","method":"POST","decoded_url":" /api/login","header":{"Authorization":"admin KBaSIIb5rTT0rbgLrixpnIl5ZdtJahdYRHCa+up8mGo=","Authorization-Date":"2023-04-07 11:48:13","Content-Type":"application/x-www-form-urlencoded; cha rset=UTF-8","Token":""},"body":"username=admin&password=21232f297a57a5a743894a0e4a801fc3"},"response":{"header":{"Access-Control-Allow-Credentials":["true"],"Access-Control-Allow-Origin":[ ""],"Content-Type":["application/json; charset=utf-8"],"Trace-Id":["093d611b2027c5a1a3cd"],"Vary":["Origin"]},"body":null,"business_code":10101,"business_code_msg":"内部服务器错误" ,"http_code":500,"http_code_msg":"Internal Server Error","cost_seconds":0.000834228},"third_party_requests":null,"debugs":null,"sqls":null,"redis":null,"success":false,"cost_seconds":0.000 834516}}

zhepoch commented 11 months ago

http://127.0.0.1:9999/install 首先通过这个页面配置服务,才能登陆