gobuffalo / buffalo-auth

Buffalo auth plugin helps adding username password authentication to your app
https://gobuffalo.io
MIT License
41 stars 28 forks source link

App failure after running `buffalo g auth` #30

Closed imorti closed 1 year ago

imorti commented 5 years ago

Steps:

  1. Create app with buffalo new <app name> --db-type=mysql
  2. Edit DB creds then run: buffalo db create -a
  3. I run the app and I can hit the standard home page. then run buffalo g auth.
  4. I run buffalo db migrate.
  5. I run buffalo dev.
  6. Browser pointing at http://localhost:3000 and see error 404 and error below:

sql: no rows in result set github.com/gobuffalo/pop.genericSelectOne /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/dialect.go:131 github.com/gobuffalo/pop.(mysql).SelectOne /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/dialect_mysql.go:92 github.com/gobuffalo/pop.(Query).First.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/finders.go:77 github.com/gobuffalo/pop.(Connection).timeFunc /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/connection.go:199 github.com/gobuffalo/pop.(Query).First /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/finders.go:74 github.com/gobuffalo/pop.(Query).Find /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/finders.go:43 github.com/gobuffalo/pop.(Connection).Find /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/finders.go:25 github.com/imorti/elevation/actions.SetCurrentUser.func1 /Users/imorti/work/go/src/github.com/imorti/elevation/actions/users.go:48 github.com/gobuffalo/mw-i18n.(Translator).Middleware.func1.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/mw-i18n@v0.0.0-20181027200759-09e0c99be4d3/i18n.go:130 github.com/gobuffalo/buffalo-pop/pop/popmw.Transaction.func2.1.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo-pop@v1.3.0/pop/popmw/tx.go:52 github.com/gobuffalo/pop.(Connection).Transaction.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/connection.go:127 github.com/gobuffalo/pop.(mysql).Lock /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/dialect_mysql.go:150 github.com/gobuffalo/pop.(Connection).Transaction /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/connection.go:121 github.com/gobuffalo/buffalo-pop/pop/popmw.Transaction.func2.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo-pop@v1.3.0/pop/popmw/tx.go:39 github.com/gobuffalo/mw-csrf.glob..func1.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/mw-csrf@v0.0.0-20180802151833-446ff26e108b/csrf.go:120 github.com/gobuffalo/mw-paramlogger.parameterLogger.Middleware.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/mw-paramlogger@v0.0.0-20181005191442-d6ee392ec72e/param_logger.go:63 github.com/gobuffalo/mw-forcessl.Middleware.func1.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/mw-forcessl@v0.0.0-20180802152810-73921ae7a130/forcessl.go:26 github.com/gobuffalo/buffalo.sessionSaver.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/session.go:70 github.com/gobuffalo/buffalo.RequestLoggerFunc.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/request_logger.go:54 github.com/gobuffalo/buffalo.(App).PanicHandler.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/errors.go:82 github.com/gobuffalo/buffalo.(App).defaultErrorMiddleware.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/errors.go:88 github.com/gobuffalo/buffalo.RouteInfo.ServeHTTP /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/route_info.go:108 github.com/gobuffalo/buffalo.(*RouteInfo).ServeHTTP

:1 github.com/gorilla/mux.(*Router).ServeHTTP /Users/imorti/work/go/pkg/mod/github.com/gorilla/mux@v1.6.2/mux.go:162 github.com/markbates/refresh/refresh/web.ErrorChecker.func1 /Users/imorti/work/go/pkg/mod/github.com/markbates/refresh@v1.4.11/refresh/web/web.go:23 net/http.HandlerFunc.ServeHTTP /usr/local/opt/go/libexec/src/net/http/server.go:1964 github.com/gobuffalo/buffalo.(*App).ServeHTTP /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/server.go:126 net/http.serverHandler.ServeHTTP /usr/local/opt/go/libexec/src/net/http/server.go:2741 net/http.(*conn).serve /usr/local/opt/go/libexec/src/net/http/server.go:1847 runtime.goexit /usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1333 mysql select one github.com/gobuffalo/pop.(*mysql).SelectOne /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/dialect_mysql.go:92 github.com/gobuffalo/pop.(*Query).First.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/finders.go:77 github.com/gobuffalo/pop.(*Connection).timeFunc /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/connection.go:199 github.com/gobuffalo/pop.(*Query).First /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/finders.go:74 github.com/gobuffalo/pop.(*Query).Find /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/finders.go:43 github.com/gobuffalo/pop.(*Connection).Find /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/finders.go:25 github.com/imorti/elevation/actions.SetCurrentUser.func1 /Users/imorti/work/go/src/github.com/imorti/elevation/actions/users.go:48 github.com/gobuffalo/mw-i18n.(*Translator).Middleware.func1.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/mw-i18n@v0.0.0-20181027200759-09e0c99be4d3/i18n.go:130 github.com/gobuffalo/buffalo-pop/pop/popmw.Transaction.func2.1.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo-pop@v1.3.0/pop/popmw/tx.go:52 github.com/gobuffalo/pop.(*Connection).Transaction.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/connection.go:127 github.com/gobuffalo/pop.(*mysql).Lock /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/dialect_mysql.go:150 github.com/gobuffalo/pop.(*Connection).Transaction /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/connection.go:121 github.com/gobuffalo/buffalo-pop/pop/popmw.Transaction.func2.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo-pop@v1.3.0/pop/popmw/tx.go:39 github.com/gobuffalo/mw-csrf.glob..func1.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/mw-csrf@v0.0.0-20180802151833-446ff26e108b/csrf.go:120 github.com/gobuffalo/mw-paramlogger.parameterLogger.Middleware.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/mw-paramlogger@v0.0.0-20181005191442-d6ee392ec72e/param_logger.go:63 github.com/gobuffalo/mw-forcessl.Middleware.func1.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/mw-forcessl@v0.0.0-20180802152810-73921ae7a130/forcessl.go:26 github.com/gobuffalo/buffalo.sessionSaver.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/session.go:70 github.com/gobuffalo/buffalo.RequestLoggerFunc.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/request_logger.go:54 github.com/gobuffalo/buffalo.(*App).PanicHandler.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/errors.go:82 github.com/gobuffalo/buffalo.(*App).defaultErrorMiddleware.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/errors.go:88 github.com/gobuffalo/buffalo.RouteInfo.ServeHTTP /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/route_info.go:108 github.com/gobuffalo/buffalo.(*RouteInfo).ServeHTTP :1 github.com/gorilla/mux.(*Router).ServeHTTP /Users/imorti/work/go/pkg/mod/github.com/gorilla/mux@v1.6.2/mux.go:162 github.com/markbates/refresh/refresh/web.ErrorChecker.func1 /Users/imorti/work/go/pkg/mod/github.com/markbates/refresh@v1.4.11/refresh/web/web.go:23 net/http.HandlerFunc.ServeHTTP /usr/local/opt/go/libexec/src/net/http/server.go:1964 github.com/gobuffalo/buffalo.(*App).ServeHTTP /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/server.go:126 net/http.serverHandler.ServeHTTP /usr/local/opt/go/libexec/src/net/http/server.go:2741 net/http.(*conn).serve /usr/local/opt/go/libexec/src/net/http/server.go:1847 runtime.goexit /usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1333 github.com/gobuffalo/pop.(*Connection).timeFunc /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/connection.go:202 github.com/gobuffalo/pop.(*Query).First /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/finders.go:74 github.com/gobuffalo/pop.(*Query).Find /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/finders.go:43 github.com/gobuffalo/pop.(*Connection).Find /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/finders.go:25 github.com/imorti/elevation/actions.SetCurrentUser.func1 /Users/imorti/work/go/src/github.com/imorti/elevation/actions/users.go:48 github.com/gobuffalo/mw-i18n.(*Translator).Middleware.func1.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/mw-i18n@v0.0.0-20181027200759-09e0c99be4d3/i18n.go:130 github.com/gobuffalo/buffalo-pop/pop/popmw.Transaction.func2.1.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo-pop@v1.3.0/pop/popmw/tx.go:52 github.com/gobuffalo/pop.(*Connection).Transaction.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/connection.go:127 github.com/gobuffalo/pop.(*mysql).Lock /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/dialect_mysql.go:150 github.com/gobuffalo/pop.(*Connection).Transaction /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/connection.go:121 github.com/gobuffalo/buffalo-pop/pop/popmw.Transaction.func2.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo-pop@v1.3.0/pop/popmw/tx.go:39 github.com/gobuffalo/mw-csrf.glob..func1.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/mw-csrf@v0.0.0-20180802151833-446ff26e108b/csrf.go:120 github.com/gobuffalo/mw-paramlogger.parameterLogger.Middleware.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/mw-paramlogger@v0.0.0-20181005191442-d6ee392ec72e/param_logger.go:63 github.com/gobuffalo/mw-forcessl.Middleware.func1.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/mw-forcessl@v0.0.0-20180802152810-73921ae7a130/forcessl.go:26 github.com/gobuffalo/buffalo.sessionSaver.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/session.go:70 github.com/gobuffalo/buffalo.RequestLoggerFunc.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/request_logger.go:54 github.com/gobuffalo/buffalo.(*App).PanicHandler.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/errors.go:82 github.com/gobuffalo/buffalo.(*App).defaultErrorMiddleware.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/errors.go:88 github.com/gobuffalo/buffalo.RouteInfo.ServeHTTP /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/route_info.go:108 github.com/gobuffalo/buffalo.(*RouteInfo).ServeHTTP :1 github.com/gorilla/mux.(*Router).ServeHTTP /Users/imorti/work/go/pkg/mod/github.com/gorilla/mux@v1.6.2/mux.go:162 github.com/markbates/refresh/refresh/web.ErrorChecker.func1 /Users/imorti/work/go/pkg/mod/github.com/markbates/refresh@v1.4.11/refresh/web/web.go:23 net/http.HandlerFunc.ServeHTTP /usr/local/opt/go/libexec/src/net/http/server.go:1964 github.com/gobuffalo/buffalo.(*App).ServeHTTP /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/server.go:126 net/http.serverHandler.ServeHTTP /usr/local/opt/go/libexec/src/net/http/server.go:2741 net/http.(*conn).serve /usr/local/opt/go/libexec/src/net/http/server.go:1847 runtime.goexit /usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1333 github.com/imorti/elevation/actions.SetCurrentUser.func1 /Users/imorti/work/go/src/github.com/imorti/elevation/actions/users.go:50 github.com/gobuffalo/mw-i18n.(*Translator).Middleware.func1.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/mw-i18n@v0.0.0-20181027200759-09e0c99be4d3/i18n.go:130 github.com/gobuffalo/buffalo-pop/pop/popmw.Transaction.func2.1.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo-pop@v1.3.0/pop/popmw/tx.go:52 github.com/gobuffalo/pop.(*Connection).Transaction.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/connection.go:127 github.com/gobuffalo/pop.(*mysql).Lock /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/dialect_mysql.go:150 github.com/gobuffalo/pop.(*Connection).Transaction /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/connection.go:121 github.com/gobuffalo/buffalo-pop/pop/popmw.Transaction.func2.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo-pop@v1.3.0/pop/popmw/tx.go:39 github.com/gobuffalo/mw-csrf.glob..func1.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/mw-csrf@v0.0.0-20180802151833-446ff26e108b/csrf.go:120 github.com/gobuffalo/mw-paramlogger.parameterLogger.Middleware.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/mw-paramlogger@v0.0.0-20181005191442-d6ee392ec72e/param_logger.go:63 github.com/gobuffalo/mw-forcessl.Middleware.func1.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/mw-forcessl@v0.0.0-20180802152810-73921ae7a130/forcessl.go:26 github.com/gobuffalo/buffalo.sessionSaver.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/session.go:70 github.com/gobuffalo/buffalo.RequestLoggerFunc.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/request_logger.go:54 github.com/gobuffalo/buffalo.(*App).PanicHandler.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/errors.go:82 github.com/gobuffalo/buffalo.(*App).defaultErrorMiddleware.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/errors.go:88 github.com/gobuffalo/buffalo.RouteInfo.ServeHTTP /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/route_info.go:108 github.com/gobuffalo/buffalo.(*RouteInfo).ServeHTTP :1 github.com/gorilla/mux.(*Router).ServeHTTP /Users/imorti/work/go/pkg/mod/github.com/gorilla/mux@v1.6.2/mux.go:162 github.com/markbates/refresh/refresh/web.ErrorChecker.func1 /Users/imorti/work/go/pkg/mod/github.com/markbates/refresh@v1.4.11/refresh/web/web.go:23 net/http.HandlerFunc.ServeHTTP /usr/local/opt/go/libexec/src/net/http/server.go:1964 github.com/gobuffalo/buffalo.(*App).ServeHTTP /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/server.go:126 net/http.serverHandler.ServeHTTP /usr/local/opt/go/libexec/src/net/http/server.go:2741 net/http.(*conn).serve /usr/local/opt/go/libexec/src/net/http/server.go:1847 runtime.goexit /usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1333 github.com/gobuffalo/pop.(*Connection).Transaction.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/connection.go:134 github.com/gobuffalo/pop.(*mysql).Lock /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/dialect_mysql.go:150 github.com/gobuffalo/pop.(*Connection).Transaction /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/pop@v4.9.3+incompatible/connection.go:121 github.com/gobuffalo/buffalo-pop/pop/popmw.Transaction.func2.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo-pop@v1.3.0/pop/popmw/tx.go:39 github.com/gobuffalo/mw-csrf.glob..func1.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/mw-csrf@v0.0.0-20180802151833-446ff26e108b/csrf.go:120 github.com/gobuffalo/mw-paramlogger.parameterLogger.Middleware.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/mw-paramlogger@v0.0.0-20181005191442-d6ee392ec72e/param_logger.go:63 github.com/gobuffalo/mw-forcessl.Middleware.func1.1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/mw-forcessl@v0.0.0-20180802152810-73921ae7a130/forcessl.go:26 github.com/gobuffalo/buffalo.sessionSaver.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/session.go:70 github.com/gobuffalo/buffalo.RequestLoggerFunc.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/request_logger.go:54 github.com/gobuffalo/buffalo.(*App).PanicHandler.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/errors.go:82 github.com/gobuffalo/buffalo.(*App).defaultErrorMiddleware.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/errors.go:88 github.com/gobuffalo/buffalo.RouteInfo.ServeHTTP /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/route_info.go:108 github.com/gobuffalo/buffalo.(*RouteInfo).ServeHTTP :1 github.com/gorilla/mux.(*Router).ServeHTTP /Users/imorti/work/go/pkg/mod/github.com/gorilla/mux@v1.6.2/mux.go:162 github.com/markbates/refresh/refresh/web.ErrorChecker.func1 /Users/imorti/work/go/pkg/mod/github.com/markbates/refresh@v1.4.11/refresh/web/web.go:23 net/http.HandlerFunc.ServeHTTP /usr/local/opt/go/libexec/src/net/http/server.go:1964 github.com/gobuffalo/buffalo.(*App).ServeHTTP /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/server.go:126 net/http.serverHandler.ServeHTTP /usr/local/opt/go/libexec/src/net/http/server.go:2741 net/http.(*conn).serve /usr/local/opt/go/libexec/src/net/http/server.go:1847 runtime.goexit /usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1333 github.com/gobuffalo/buffalo.sessionSaver.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/session.go:72 github.com/gobuffalo/buffalo.RequestLoggerFunc.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/request_logger.go:54 github.com/gobuffalo/buffalo.(*App).PanicHandler.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/errors.go:82 github.com/gobuffalo/buffalo.(*App).defaultErrorMiddleware.func1 /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/errors.go:88 github.com/gobuffalo/buffalo.RouteInfo.ServeHTTP /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/route_info.go:108 github.com/gobuffalo/buffalo.(*RouteInfo).ServeHTTP :1 github.com/gorilla/mux.(*Router).ServeHTTP /Users/imorti/work/go/pkg/mod/github.com/gorilla/mux@v1.6.2/mux.go:162 github.com/markbates/refresh/refresh/web.ErrorChecker.func1 /Users/imorti/work/go/pkg/mod/github.com/markbates/refresh@v1.4.11/refresh/web/web.go:23 net/http.HandlerFunc.ServeHTTP /usr/local/opt/go/libexec/src/net/http/server.go:1964 github.com/gobuffalo/buffalo.(*App).ServeHTTP /Users/imorti/work/go/pkg/mod/github.com/gobuffalo/buffalo@v0.13.9/server.go:126 net/http.serverHandler.ServeHTTP /usr/local/opt/go/libexec/src/net/http/server.go:2741 net/http.(*conn).serve /usr/local/opt/go/libexec/src/net/http/server.go:1847 runtime.goexit /usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1333
imorti commented 5 years ago

More logs:

DEBU[2018-12-08T16:55:49-08:00] SELECT users.created_at, users.email, users.id, users.password_hash, users.updated_at FROM users AS users WHERE users.id = ? LIMIT 1 $1=0207be31-5365-4ab2-9e7a-c052a097b266 INFO[2018-12-08T16:55:49-08:00] / content_type=text/html db=2.388529ms duration=8.203385ms human_size="0 B" method=GET params="{}" path=/ request_id=AtalzMvdLF-KoklAKqWAS size=0 status=0 ERRO[2018-12-08T16:55:49-08:00] mysql select one: sql: no rows in result set content_type=text/html db=2.388529ms duration=8.203385ms human_size="0 B" method=GET params="{}" path=/ request_id=AtalzMvdLF-KoklAKqWAS size=0 status=0 DEBU[2018-12-08T16:57:28-08:00] SELECT users.created_at, users.email, users.id, users.password_hash, users.updated_at FROM users AS users WHERE users.id = ? LIMIT 1 $1=0207be31-5365-4ab2-9e7a-c052a097b266 INFO[2018-12-08T16:57:28-08:00] /users/new/ content_type=text/html db=4.008897ms duration=11.354812ms human_size="0 B" method=GET params="{}" path=/users/new/ request_id=AtalzMvdLF-cgGdbcUYYN size=0 status=0 ERRO[2018-12-08T16:57:28-08:00] mysql select one: sql: no rows in result set content_type=text/html db=4.008897ms duration=11.354812ms human_size="0 B" method=GET params="{}" path=/users/new/ request_id=AtalzMvdLF-cgGdbcUYYN size=0 status=0 DEBU[2018-12-08T16:57:36-08:00] SELECT users.created_at, users.email, users.id, users.password_hash, users.updated_at FROM users AS users WHERE users.id = ? LIMIT 1 $1=0207be31-5365-4ab2-9e7a-c052a097b266 INFO[2018-12-08T16:57:36-08:00] / content_type=text/html db=1.434661ms duration=14.518212ms human_size="0 B" method=GET params="{}" path=/ request_id=AtalzMvdLF-uaUAFOmJhv size=0 status=0 ERRO[2018-12-08T16:57:36-08:00] mysql select one: sql: no rows in result set content_type=text/html db=1.434661ms duration=14.518212ms human_size="0 B" method=GET params="{}" path=/ request_id=AtalzMvdLF-uaUAFOmJhv size=0 status=0

mjfryc commented 5 years ago

I have the same problem but with different stack trace. Buffalo version is: v0.14.0

I've performed steps from: https://gobuffalo.io/en/docs/auth

and the result is:

Error Trace:

sqlite select one: sql: no rows in result set github.com/gobuffalo/buffalo.sessionSaver.func1 /home/cq/go/src/github.com/gobuffalo/buffalo/session.go:72 github.com/gobuffalo/buffalo.RequestLoggerFunc.func1 /home/cq/go/src/github.com/gobuffalo/buffalo/request_logger.go:54 github.com/gobuffalo/buffalo.(App).PanicHandler.func1 /home/cq/go/src/github.com/gobuffalo/buffalo/errors.go:95 github.com/gobuffalo/buffalo.(App).defaultErrorMiddleware.func1 /home/cq/go/src/github.com/gobuffalo/buffalo/errors.go:101 github.com/gobuffalo/buffalo.RouteInfo.ServeHTTP /home/cq/go/src/github.com/gobuffalo/buffalo/route_info.go:109 github.com/gobuffalo/buffalo.(*RouteInfo).ServeHTTP

:1 github.com/gorilla/mux.(*Router).ServeHTTP /home/cq/go/src/github.com/gorilla/mux/mux.go:212 github.com/markbates/refresh/refresh/web.ErrorChecker.func1 /home/cq/go/src/github.com/markbates/refresh/refresh/web/web.go:23 net/http.HandlerFunc.ServeHTTP /usr/lib/go-1.10/src/net/http/server.go:1947 github.com/gobuffalo/buffalo.(*App).ServeHTTP /home/cq/go/src/github.com/gobuffalo/buffalo/server.go:134 net/http.serverHandler.ServeHTTP /usr/lib/go-1.10/src/net/http/server.go:2697 net/http.(*conn).serve /usr/lib/go-1.10/src/net/http/server.go:1830 runtime.goexit /usr/lib/go-1.10/src/runtime/asm_amd64.s:2361

Context:

T: %!s(i18n.TranslateFunc=0xa860d0) authenticity_token: Jym+u25jniN6RoEFADyOgb7AaepXDmgD0EPdK/ujrzTjXiC6v6E/GLA4KvCsdzXfjyvVaKQkxxTNZ0/WjOk7EQ== contentType: text/html current_path: / current_route: { "method": "GET", "path": "/", "handler": "mj/hello_0/actions.HomeHandler", "pathName": "rootPath", "aliases": [] } env: development languages: [en-US en en-US] method: GET request_id: iqwRcaISKm-uGEAXQgWvP t: %!s(func(string, ...interface {}) string=0xa88160) tx: /home/cq/go/src/mj/hello_0_hello_0_development.sqlite?_busy_timeout=5000

hookover commented 4 years ago

how can disabled no rows in result set ?

bmo-at commented 4 years ago

Did anyone ever figure out a fix for this?

After the steps, my application was working fine, but for some reason after running buffalo generate auth a second time with additional parameters it now throws the sql: no rows in result set, despite the database having the correct schema...

bmo-at commented 4 years ago

Ok, this is really stupid: If the projekt name includes a -, buffalo-auth completely fucks up. Steps to recreate: Create app with buffalo new authtest --db-type=mysql Create app with buffalo new auth-test --db-type=mysql Edit DB creds for both projects then run: buffalo db create in each (separate databases) Run buffalo dev and verify the generated apps both work, after which you run buffalo g auth in both After its done, run buffalo migrate up Starting up both apps separately with buffalo dev will result in very different behaviour: the one named authtest will run just fine, while the one name auth-test will throw sql: no rows in result set

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment. Otherwise, this will be closed in 7 days.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment. Otherwise, this will be closed in 7 days.

sio4 commented 1 year ago

The issue is caused by the development steps you had done:

  1. Create app with buffalo new <app name> --db-type=mysql
  2. Edit DB creds then run: buffalo db create -a
  3. I run the app and I can hit the standard home page. then run buffalo g auth.
  4. I run buffalo db migrate.
  5. I run buffalo dev.
  6. Browser pointing at http://localhost:3000 and see error 404 and error below:

In step 3, you already ran the app and I am not sure if there are missing steps within step 3.

The issue is that,

  1. maybe around step 3, you might have some more steps to test buffalo-auth and your browser had stored cookie (which is used for session store by default) with current_user_id I guess.
  2. after that, even though you reset the database at some point, the browser still has the user id previously used, which doesn't exist in the actual database now.
  3. when the SetCurrentUser middleware runs, the middleware sees the stored user id in the session and tries to find the user in the database but is not found.
  4. the current implementation just threw a general error you've seen when the user is not found.

The following line indicates that:

sql: no rows in result set <...> github.com/imorti/elevation/actions.SetCurrentUser.func1 /Users/imorti/work/go/src/github.com/imorti/elevation/actions/users.go:48

Also, as you can see, there was a query with users.id 0207be31-...:

DEBU[2018-12-08T16:55:49-08:00] SELECT users.created_at, users.email, users.id, users.password_hash, users.updated_at FROM users AS users WHERE users.id = ? LIMIT 1 $1=0207be31-5365-4ab2-9e7a-c052a097b266

In another report, the reporter mentioned different behavior per the project names but the actual difference might be caused by cookies (one has the user id, another has none, and they have different cookie names)

Ok, this is really stupid: If the projekt name includes a -, buffalo-auth completely fucks up. <...> Starting up both apps separately with buffalo dev will result in very different behaviour: the one named authtest will run just fine, while the one name auth-test will throw sql: no rows in result set

I would like to create a PR to fix the behavior when a user is not found.

sio4 commented 1 year ago

fixed by #92.

please feel free to report if there is any issues still there. (will be released as v1.5.0 soon)