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

Unable to login - ERROR engine/engine.go:323 no such column: plugin_name #2

Open
skull-squadron opened this issue Feb 6, 2023 · 2 comments

Comments

@skull-squadron
Copy link

Reproduce

  1. Modify `Dockerfile`
    RUN echo 'case ":$PATH:" in *:/usr/local/go/bin:*) ;; *) export PATH="/usr/local/go/bin${PATH:+:}${PATH}" ;; esac' > /etc/profile.d/go.sh
    
  2. Build and run docker image
    docker run --rm -it -p 8080:8080 $(docker build -q . | cut -d: -f2) go run .
    
  3. Visit http://localhost:8080/admin

    Log: 2023-02-06T00:42:31.317Z controller/handler.go:24 [GoAdmin] 200 GET /admin/login

  4. (ERROR LOG) Try to login ( user:admin, password: admin )

    Browser ERR_EMPTY_RESPONSE

     2023-02-06T00:45:12.247Z	controller/handler.go:24	[GoAdmin]  200   POST    /admin/signin
     2023-02-06T00:45:12.271Z	ERROR	engine/engine.go:323	no such column: plugin_name
     github.com/GoAdminGroup/go-admin/engine.(*Engine).deferHandler.func1.1
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/engine/engine.go:323
     runtime.gopanic
     	/usr/local/go/src/runtime/panic.go:838
     github.com/GoAdminGroup/go-admin/modules/db.CommonQuery
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/modules/db/performer.go:20
     github.com/GoAdminGroup/go-admin/modules/db.(*Sqlite).QueryWithConnection
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/modules/db/sqlite.go:49
     github.com/GoAdminGroup/go-admin/modules/db.(*Sqlite).QueryWith
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/modules/db/sqlite.go:71
     github.com/GoAdminGroup/go-admin/modules/db.(*SQL).All
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/modules/db/statement.go:442
     github.com/GoAdminGroup/go-admin/modules/menu.GetGlobalMenu
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/modules/menu/menu.go:188
     github.com/GoAdminGroup/go-admin/engine.(*Engine).HTML.func1
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/engine/engine.go:538
     github.com/GoAdminGroup/go-admin/context.(*Context).Next
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/context/context.go:101
     github.com/GoAdminGroup/go-admin/modules/auth.(*Invoker).Middleware.func1
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/modules/auth/middleware.go:132
     github.com/GoAdminGroup/go-admin/context.(*Context).Next
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/context/context.go:101
     github.com/GoAdminGroup/go-admin/engine.(*Engine).deferHandler.func1
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/engine/engine.go:350
     github.com/GoAdminGroup/go-admin/context.(*Context).Next
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/context/context.go:101
     github.com/GoAdminGroup/go-admin/adapter/iris.(*Iris).AddHandler.func1
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/adapter/iris/iris.go:93
     github.com/kataras/iris/v12/context.(*Context).Do
     	/go/pkg/mod/github.com/kataras/iris/[email protected]/context/context.go:530
     github.com/kataras/iris/v12/core/router.(*routerHandler).HandleRequest
     	/go/pkg/mod/github.com/kataras/iris/[email protected]/core/router/handler.go:449
     github.com/kataras/iris/v12/core/router.(*Router).buildMainHandler.func1
     	/go/pkg/mod/github.com/kataras/iris/[email protected]/core/router/router.go:103
     github.com/kataras/iris/v12/core/router.(*Router).ServeHTTP
     	/go/pkg/mod/github.com/kataras/iris/[email protected]/core/router/router.go:343
     net/http.serverHandler.ServeHTTP
     	/usr/local/go/src/net/http/server.go:2916
     net/http.(*conn).serve
     	/usr/local/go/src/net/http/server.go:1966
     2023-02-06T00:45:12.272Z	ERROR	engine/engine.go:324	goroutine 125 [running]:
     runtime/debug.Stack()
     	/usr/local/go/src/runtime/debug/stack.go:24 +0x65
     github.com/GoAdminGroup/go-admin/engine.(*Engine).deferHandler.func1.1(0xc0003c4480)
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/engine/engine.go:324 +0x31e
     panic({0x18768a0, 0xc000eb0330})
     	/usr/local/go/src/runtime/panic.go:838 +0x207
     github.com/GoAdminGroup/go-admin/modules/db.CommonQuery(0x17b55a0?, {0xc000e86240?, 0x191ef93?}, {0xc0007f8d20?, 0x1f05dd8?, 0xc000326140?})
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/modules/db/performer.go:20 +0x685
     github.com/GoAdminGroup/go-admin/modules/db.(*Sqlite).QueryWithConnection(...)
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/modules/db/sqlite.go:49
     github.com/GoAdminGroup/go-admin/modules/db.(*Sqlite).QueryWith(0x1f05dd8?, 0x1?, {0x191ef93?, 0x3?}, {0xc000e86240, 0x58}, {0xc0007f8d20, 0x2, 0x2})
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/modules/db/sqlite.go:71 +0x9e
     github.com/GoAdminGroup/go-admin/modules/db.(*SQL).All(0xc000326140)
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/modules/db/statement.go:442 +0x102
     github.com/GoAdminGroup/go-admin/modules/menu.GetGlobalMenu({{{0xc000c2d440, 0xd}, {0x1f1e220, 0xc000bc45e0}, 0x0}, 0x1, {0xc000840a78, 0x5}, {0xc000840a40, 0x5}, ...}, ...)
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/modules/menu/menu.go:188 +0x673
     github.com/GoAdminGroup/go-admin/engine.(*Engine).HTML.func1(0xc0003c4480)
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/engine/engine.go:538 +0x3b6
     github.com/GoAdminGroup/go-admin/context.(*Context).Next(0xc0003c4480)
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/context/context.go:101 +0x36
     github.com/GoAdminGroup/go-admin/modules/auth.(*Invoker).Middleware.func1(0xc0003c4480)
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/modules/auth/middleware.go:132 +0x255
     github.com/GoAdminGroup/go-admin/context.(*Context).Next(0xc0003c4480)
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/context/context.go:101 +0x36
     github.com/GoAdminGroup/go-admin/engine.(*Engine).deferHandler.func1(0xc0005cf660?)
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/engine/engine.go:350 +0xa6
     github.com/GoAdminGroup/go-admin/context.(*Context).Next(0xc0003c4480)
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/context/context.go:101 +0x36
     github.com/GoAdminGroup/go-admin/adapter/iris.(*Iris).AddHandler.func1(0xc00054c640)
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/adapter/iris/iris.go:93 +0x3f1
     github.com/kataras/iris/v12/context.(*Context).Do(...)
     	/go/pkg/mod/github.com/kataras/iris/[email protected]/context/context.go:530
     github.com/kataras/iris/v12/core/router.(*routerHandler).HandleRequest(0xc000c76180, 0xc00054c640)
     	/go/pkg/mod/github.com/kataras/iris/[email protected]/core/router/handler.go:449 +0x384
     github.com/kataras/iris/v12/core/router.(*Router).buildMainHandler.func1({0x1f13130?, 0xc00024e0e0?}, 0x9dc000?)
     	/go/pkg/mod/github.com/kataras/iris/[email protected]/core/router/router.go:103 +0x63
     github.com/kataras/iris/v12/core/router.(*Router).ServeHTTP(0x0?, {0x1f13130?, 0xc00024e0e0?}, 0xc00012d400?)
     	/go/pkg/mod/github.com/kataras/iris/[email protected]/core/router/router.go:343 +0x30
     net/http.serverHandler.ServeHTTP({0xc0007f60f0?}, {0x1f13130, 0xc00024e0e0}, 0xc000650200)
     	/usr/local/go/src/net/http/server.go:2916 +0x43b
     net/http.(*conn).serve(0xc00054c3c0, {0x1f13ee0, 0xc00079d830})
     	/usr/local/go/src/net/http/server.go:1966 +0x5d7
     created by net/http.(*Server).Serve
     	/usr/local/go/src/net/http/server.go:3071 +0x4db
     
     github.com/GoAdminGroup/go-admin/engine.(*Engine).deferHandler.func1.1
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/engine/engine.go:324
     runtime.gopanic
     	/usr/local/go/src/runtime/panic.go:838
     github.com/GoAdminGroup/go-admin/modules/db.CommonQuery
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/modules/db/performer.go:20
     github.com/GoAdminGroup/go-admin/modules/db.(*Sqlite).QueryWithConnection
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/modules/db/sqlite.go:49
     github.com/GoAdminGroup/go-admin/modules/db.(*Sqlite).QueryWith
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/modules/db/sqlite.go:71
     github.com/GoAdminGroup/go-admin/modules/db.(*SQL).All
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/modules/db/statement.go:442
     github.com/GoAdminGroup/go-admin/modules/menu.GetGlobalMenu
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/modules/menu/menu.go:188
     github.com/GoAdminGroup/go-admin/engine.(*Engine).HTML.func1
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/engine/engine.go:538
     github.com/GoAdminGroup/go-admin/context.(*Context).Next
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/context/context.go:101
     github.com/GoAdminGroup/go-admin/modules/auth.(*Invoker).Middleware.func1
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/modules/auth/middleware.go:132
     github.com/GoAdminGroup/go-admin/context.(*Context).Next
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/context/context.go:101
     github.com/GoAdminGroup/go-admin/engine.(*Engine).deferHandler.func1
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/engine/engine.go:350
     github.com/GoAdminGroup/go-admin/context.(*Context).Next
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/context/context.go:101
     github.com/GoAdminGroup/go-admin/adapter/iris.(*Iris).AddHandler.func1
     	/go/pkg/mod/github.com/responsibility-act/[email protected]/adapter/iris/iris.go:93
     github.com/kataras/iris/v12/context.(*Context).Do
     	/go/pkg/mod/github.com/kataras/iris/[email protected]/context/context.go:530
     github.com/kataras/iris/v12/core/router.(*routerHandler).HandleRequest
     	/go/pkg/mod/github.com/kataras/iris/[email protected]/core/router/handler.go:449
     github.com/kataras/iris/v12/core/router.(*Router).buildMainHandler.func1
     	/go/pkg/mod/github.com/kataras/iris/[email protected]/core/router/router.go:103
     github.com/kataras/iris/v12/core/router.(*Router).ServeHTTP
     	/go/pkg/mod/github.com/kataras/iris/[email protected]/core/router/router.go:343
     net/http.serverHandler.ServeHTTP
     	/usr/local/go/src/net/http/server.go:2916
     net/http.(*conn).serve
     	/usr/local/go/src/net/http/server.go:1966
    
    
    
     
    
    
Output of 2. Build and run
go: downloading github.com/kataras/iris/v12 v12.2.0-beta7
go: downloading github.com/responsibility-act/go-admin v0.0.2
go: downloading github.com/GoAdminGroup/themes v0.0.43
go: downloading github.com/jinzhu/gorm v1.9.16
go: downloading github.com/jinzhu/inflection v1.0.0
go: downloading github.com/mattn/go-sqlite3 v1.14.15
go: downloading github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d
go: downloading go.uber.org/zap v1.23.0
go: downloading github.com/GoAdminGroup/html v0.0.1
go: downloading github.com/natefinch/lumberjack v2.0.0+incompatible
go: downloading golang.org/x/crypto v0.4.0
go: downloading github.com/NebulousLabs/fastrand v0.0.0-20181203155948-6fb6489aac4e
go: downloading github.com/google/uuid v1.3.0
go: downloading gopkg.in/ini.v1 v1.67.0
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading golang.org/x/text v0.5.0
go: downloading xorm.io/xorm v1.3.2
go: downloading github.com/gin-gonic/gin v1.8.1
go: downloading github.com/360EntSecGroup-Skylar/excelize v1.4.1
go: downloading github.com/mattn/go-colorable v0.1.6
go: downloading github.com/tdewolff/minify/v2 v2.12.4
go: downloading github.com/kataras/golog v0.1.8
go: downloading github.com/kataras/tunnel v0.0.4
go: downloading github.com/BurntSushi/toml v1.2.1
go: downloading github.com/kataras/sitemap v0.0.6
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385
go: downloading github.com/CloudyKit/jet/v6 v6.2.0
go: downloading golang.org/x/time v0.3.0
go: downloading github.com/flosch/pongo2/v4 v4.0.2
go: downloading github.com/yosssi/ace v0.0.5
go: downloading github.com/mailgun/raymond/v2 v2.0.48
go: downloading github.com/kataras/blocks v0.0.7
go: downloading github.com/fatih/structs v1.1.0
go: downloading github.com/Joker/jade v1.1.3
go: downloading golang.org/x/sys v0.3.0
go: downloading google.golang.org/protobuf v1.28.1
go: downloading github.com/json-iterator/go v1.1.12
go: downloading github.com/mailru/easyjson v0.7.7
go: downloading github.com/russross/blackfriday/v2 v2.1.0
go: downloading github.com/vmihailenco/msgpack/v5 v5.3.5
go: downloading github.com/iris-contrib/schema v0.0.6
go: downloading github.com/andybalholm/brotli v1.0.4
go: downloading github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06
go: downloading github.com/microcosm-cc/bluemonday v1.0.21
go: downloading golang.org/x/net v0.4.0
go: downloading github.com/golang/snappy v0.0.4
go: downloading github.com/klauspost/compress v1.15.13
go: downloading github.com/kataras/pio v0.0.11
go: downloading github.com/schollz/closestmatch v2.1.0+incompatible
go: downloading github.com/mattn/go-isatty v0.0.16
go: downloading github.com/gin-contrib/sse v0.1.0
go: downloading github.com/ugorji/go/codec v1.2.7
go: downloading github.com/pelletier/go-toml/v2 v2.0.1
go: downloading github.com/go-playground/validator/v10 v10.10.0
go: downloading go.uber.org/multierr v1.6.0
go: downloading go.uber.org/atomic v1.7.0
go: downloading github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
go: downloading xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978
go: downloading github.com/syndtr/goleveldb v1.0.0
go: downloading github.com/valyala/bytebufferpool v1.0.0
go: downloading github.com/josharian/intern v1.0.0
go: downloading github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53
go: downloading github.com/sirupsen/logrus v1.8.1
go: downloading github.com/vmihailenco/tagparser/v2 v2.0.0
go: downloading github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
go: downloading github.com/modern-go/reflect2 v1.0.2
go: downloading github.com/aymerick/douceur v0.2.0
go: downloading github.com/go-playground/universal-translator v0.18.0
go: downloading github.com/leodido/go-urn v1.2.1
go: downloading github.com/gorilla/css v1.0.0
go: downloading github.com/go-playground/locales v0.14.0
go: downloading github.com/tdewolff/parse/v2 v2.6.4
go: downloading github.com/gobuffalo/packr/v2 v2.8.3
go: downloading github.com/markbates/safe v1.0.1
go: downloading github.com/gobuffalo/packd v1.0.1
go: downloading github.com/markbates/oncer v1.0.0
go: downloading github.com/karrick/godirwalk v1.16.1
go: downloading github.com/gobuffalo/logger v1.0.6
go: downloading github.com/markbates/errx v1.1.0
go: downloading golang.org/x/term v0.3.0
GoAdmin is now running.
Running in "debug" mode. Switch to "release" mode in production.

2023-02-06T00:40:23.229Z	INFO	engine/engine.go:402	=====> Initialize database connections
2023-02-06T00:40:23.236Z	INFO	engine/engine.go:402	=====> Initialize configuration
2023-02-06T00:40:23.239Z	INFO	engine/engine.go:402	=====> Initialize navigation buttons
2023-02-06T00:40:23.239Z	INFO	engine/engine.go:402	=====> Initialize plugins
2023-02-06T00:40:23.239Z	INFO	engine/engine.go:402	=====> Initialize success🍺🍺
Iris Version: 12.2.0-beta7

Now listening on: http://localhost:8080
Application started. Press CTRL+C to shut down.

Full log

Also, it does the same locally without Docker.

@charlesduarte019
Copy link

  1. Run go run . and then stop, only to create file admin.db
  2. Run sqlite3 admin.db to open the database
  3. Run ALTER TABLE goadmin_menu ADD COLUMN `uuid` varchar(150) NOT NULL DEFAULT '';
  4. Run ALTER TABLE goadmin_menu ADD COLUMN `plugin_name` varchar(150) NOT NULL DEFAULT '';
  5. Run again go run .

@devloberto
Copy link

Hey there ✌🏼 I was facing the same issue without docker, just using iris-cli run go-admin.
After running the SQL queries of @charlesduarte019 the login worked (more or less):

  1. Run go run . and then stop, only to create file admin.db
  2. Run sqlite3 admin.db to open the database
  3. Run ALTER TABLE goadmin_menu ADD COLUMN `uuid` varchar(150) NOT NULL DEFAULT '';
  4. Run ALTER TABLE goadmin_menu ADD COLUMN `plugin_name` varchar(150) NOT NULL DEFAULT '';
  5. Run again go run .

After the login with admin:admin the iris-cli does a lot hot reloads though there are no changes at all. I'm not sure if this behaviour is to be expected. The terminal output is attached.
iris-cli_run_go-admin.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants