admin icon indicating copy to clipboard operation
admin copied to clipboard

net/http.(*Server).Serve error

Open ghost opened this issue 6 years ago • 5 comments

Hi guys,

Hope you are all well !

I try to run qor-admin from a docker container, and it is triggering a weird error from net/http package.

ref. https://github.com/x0rzkov/oniontree

docker-compose up

gives me the following error

oniontree_1  | 2019/12/14 15:54:43 http: panic serving 172.19.0.3:35988: runtime error: invalid memory address or nil pointer dereference
oniontree_1  | goroutine 1022 [running]:
oniontree_1  | net/http.(*conn).serve.func1(0xc000152140)
oniontree_1  | 	/usr/local/go/src/net/http/server.go:1767 +0x139
oniontree_1  | panic(0xa52400, 0xf83e20)
oniontree_1  | 	/usr/local/go/src/runtime/panic.go:679 +0x1b2
oniontree_1  | html/template.(*Template).escape(0x0, 0x0, 0x0)
oniontree_1  | 	/usr/local/go/src/html/template/template.go:95 +0x42
oniontree_1  | html/template.(*Template).Execute(0x0, 0xbe44a0, 0xc000410000, 0xaebd40, 0xc000174000, 0x1, 0xc00009a090)
oniontree_1  | 	/usr/local/go/src/html/template/template.go:119 +0x2f
oniontree_1  | github.com/qor/admin.(*Context).Execute(0xc000174000, 0xaf396d, 0x9, 0x0, 0x0)
oniontree_1  | 	/go/pkg/mod/github.com/qor/[email protected]/context.go:227 +0x22c
oniontree_1  | github.com/qor/admin.(*Controller).Dashboard(...)
oniontree_1  | 	/go/pkg/mod/github.com/qor/[email protected]/controller.go:28
oniontree_1  | github.com/qor/admin.(*Admin).NewServeMux.func2(0xc000174000, 0xc0003ce3e0)
oniontree_1  | 	/go/pkg/mod/github.com/qor/[email protected]/route.go:176 +0x1e6
oniontree_1  | github.com/qor/admin.Middleware.Next(...)
oniontree_1  | 	/go/pkg/mod/github.com/qor/[email protected]/route.go:37
oniontree_1  | github.com/qor/admin.(*Admin).NewServeMux.func1(0xc000174000, 0xc0003ce3c0)
oniontree_1  | 	/go/pkg/mod/github.com/qor/[email protected]/route.go:166 +0x115
oniontree_1  | github.com/qor/admin.Middleware.Next(...)
oniontree_1  | 	/go/pkg/mod/github.com/qor/[email protected]/route.go:37
oniontree_1  | github.com/qor/admin.Admin.registerCompositePrimaryKeyCallback.func1(0xc000174000, 0xc000440700)
oniontree_1  | 	/go/pkg/mod/github.com/qor/[email protected]/composite_primary_key_callback.go:27 +0x24d
oniontree_1  | github.com/qor/admin.(*serveMux).ServeHTTP(0xc0000a0668, 0xbee3a0, 0xc000410000, 0xc000462100)
oniontree_1  | 	/go/pkg/mod/github.com/qor/[email protected]/route.go:267 +0x559
oniontree_1  | net/http.(*ServeMux).ServeHTTP(0xc000392a80, 0xbee3a0, 0xc000410000, 0xc000462100)
oniontree_1  | 	/usr/local/go/src/net/http/server.go:2387 +0x1bd
oniontree_1  | net/http.serverHandler.ServeHTTP(0xc0004101c0, 0xbee3a0, 0xc000410000, 0xc000462100)
oniontree_1  | 	/usr/local/go/src/net/http/server.go:2802 +0xa4
oniontree_1  | net/http.(*conn).serve(0xc000152140, 0xbefaa0, 0xc00044a0c0)
oniontree_1  | 	/usr/local/go/src/net/http/server.go:1890 +0x875
oniontree_1  | created by net/http.(*Server).Serve
oniontree_1  | 	/usr/local/go/src/net/http/server.go:2928 +0x384

Does anyone know what is happening ?

Cheers, X

ghost avatar Dec 14 '19 15:12 ghost

@x0rzkov out of box qor admin is not compatible with go modules. The error occurred because template was not found. https://github.com/qor/auth/issues/23#issuecomment-569522292

Accordingly to https://doc.getqor.com simples solution is to compile templates into binary via https://github.com/qor/bindatafs

sergolius avatar Jan 19 '20 19:01 sergolius

Would be awesome to have a gist or repo with an example running bindatafs and qor admin.

ghost avatar Jan 20 '20 08:01 ghost

@x0rzkov just follow https://doc.getqor.com/guides/bindatafs.html and dive into source code

repo: https://github.com/sergolius/qor_bindatafs_example I tried to commit step by step

sergolius avatar Jan 26 '20 00:01 sergolius

awesome, thank you very much !

ghost avatar Jan 26 '20 06:01 ghost

@sergolius , hope you are all well !

I was just wondering if you have any idea how to sort another issue I posted https://github.com/qor/auth/issues/42

I am locked and need to find at least some hints about how to do it ^^.

ghost avatar Sep 09 '20 05:09 ghost