bug: Middleware.Skip doesn't work for non-POST routes that overlap a Resource
yujiri8 opened this issue · comments
Description
Description
We're using the auto-generated UsersResource{}
handlers for some actions, but also have a few user-related routes that don't fit into it, so we do this:
app.Use(authMiddleware)
app.Middleware.Skip(authMiddleware, signUp, confirmEmail, signIn)
app.Resource("/users", UsersResource{})
app.POST("/users/signUp", signUp)
app.GET("/users/confirm", confirmEmail)
app.POST("/users/signIn", signIn)
The middleware is skipped for signUp and signIn, but not for confirmEmail.
If you remove the UsersResource, or move the route for confirmEmail
outside /users/
, it works.
I followed the GNU/Linux instructions here: https://gobuffalo.io/documentation/getting_started/installation/#installation-from-a-release-archive---64-bits
Additional Context
Details
-> Go: Checking installation
✓ The `go` executable was found on your system at: /usr/bin/go
-> Go: Checking minimum version requirements
✓ Your version of Go, 1.20.4, meets the minimum requirements.
-> Go: Checking Package Management
✓ You are using Go Modules (`go`) for package management.
-> Go: Checking PATH
✓ Your PATH contains /home/yujiri/.local/go/bin.
-> Node: Checking installation
✓ The `node` executable was found on your system at: /usr/bin/node
-> Node: Checking minimum version requirements
✓ Your version of Node, v20.2.0, meets the minimum requirements.
-> NPM: Checking installation
✓ The `npm` executable was found on your system at: /usr/bin/npm
-> NPM: Checking minimum version requirements
✓ Your version of NPM, 9.6.7, meets the minimum requirements.
-> Yarn: Checking installation
✘ The `yarnpkg` executable could not be found on your system.
For help setting up your Yarn environment please follow the instructions for you platform at:
https://yarnpkg.com/en/docs/install
-> PostgreSQL: Checking installation
✓ The `postgres` executable was found on your system at: /usr/bin/postgres
-> PostgreSQL: Checking minimum version requirements
✓ Your version of PostgreSQL, 15.3.0, meets the minimum requirements.
-> MySQL: Checking installation
✘ The `mysql` executable could not be found on your system.
For help setting up your MySQL environment please follow the instructions for you platform at:
https://www.mysql.com/downloads/
-> SQLite3: Checking installation
✓ The `sqlite3` executable was found on your system at: /usr/bin/sqlite3
-> SQLite3: Checking minimum version requirements
✓ Your version of SQLite3, 3.42.0, meets the minimum requirements.
-> Cockroach: Checking installation
✘ The `cockroach` executable could not be found on your system.
For help setting up your Cockroach environment please follow the instructions for you platform at:
https://www.cockroachlabs.com/docs/stable/
-> Buffalo (CLI): Checking installation
✓ The `buffalo` executable was found on your system at: /home/yujiri/.local/go/bin/buffalo
-> Buffalo (CLI): Checking minimum version requirements
✓ Your version of Buffalo (CLI), v0.18.14, meets the minimum requirements.
-> Buffalo: Application Details
Pwd /home/yujiri/code/stealth
Root /home/yujiri/code/stealth
GoPath /home/yujiri/.local/go
PackagePkg stealth
ActionsPkg stealth/actions
ModelsPkg stealth/models
GriftsPkg stealth/grifts
WithModules true
Name stealth
Bin bin
VCS git
WithPop true
WithSQLite false
WithDep false
WithWebpack false
WithNodeJs false
WithYarn false
WithDocker false
WithGrifts true
AsWeb false
AsAPI true
InApp true
PackageJSON {map[]}
-> Buffalo: config/buffalo-app.toml
name = "stealth"
bin = "bin"
vcs = "git"
with_pop = true
with_sqlite = false
with_dep = false
with_webpack = false
with_nodejs = false
with_yarn = false
with_docker = false
with_grifts = true
as_web = false
as_api = true
-> Buffalo: config/buffalo-plugins.toml
[[plugin]]
binary = "buffalo-pop"
go_get = "github.com/gobuffalo/buffalo-pop/v3@latest"
-> Buffalo: go.mod
module stealth
go 1.20
require (
github.com/gobuffalo/buffalo v1.1.0
github.com/gobuffalo/buffalo-pop/v3 v3.0.7
github.com/gobuffalo/envy v1.10.2
github.com/gobuffalo/grift v1.5.2
github.com/gobuffalo/middleware v1.0.0
github.com/gobuffalo/nulls v0.4.2
github.com/gobuffalo/pop/v6 v6.1.1
github.com/gobuffalo/suite/v4 v4.0.4
github.com/gobuffalo/validate/v3 v3.3.3
github.com/gobuffalo/x v0.1.0
github.com/gofrs/uuid v4.3.1+incompatible
github.com/rs/cors v1.9.0
github.com/unrolled/secure v1.13.0
golang.org/x/crypto v0.9.0
)
require (
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/felixge/httpsnoop v1.0.1 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-sql-driver/mysql v1.7.0 // indirect
github.com/gobuffalo/events v1.4.3 // indirect
github.com/gobuffalo/fizz v1.14.4 // indirect
github.com/gobuffalo/flect v1.0.0 // indirect
github.com/gobuffalo/github_flavored_markdown v1.1.3 // indirect
github.com/gobuffalo/helpers v0.6.7 // indirect
github.com/gobuffalo/httptest v1.5.2 // indirect
github.com/gobuffalo/logger v1.0.7 // indirect
github.com/gobuffalo/meta v0.3.3 // indirect
github.com/gobuffalo/plush/v4 v4.1.18 // indirect
github.com/gobuffalo/refresh v1.13.3 // indirect
github.com/gobuffalo/tags/v3 v3.1.4 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/gorilla/sessions v1.2.1 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.13.0 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.1 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.12.0 // indirect
github.com/jackc/pgx/v4 v4.17.2 // indirect
github.com/jmoiron/sqlx v1.3.5 // indirect
github.com/joho/godotenv v1.4.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/luna-duclos/instrumentedsql v1.1.3 // indirect
github.com/mattn/go-colorable v0.1.9 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-sqlite3 v1.14.16 // indirect
github.com/microcosm-cc/bluemonday v1.0.20 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/monoculum/formam v3.5.5+incompatible // indirect
github.com/nicksnyder/go-i18n v1.10.1 // indirect
github.com/pelletier/go-toml v1.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d // indirect
github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e // indirect
github.com/spf13/cobra v1.6.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.8.1 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/term v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
I also tried checking out the main
branch of the buffalo CLI from git and building that, same result.
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.
This issue was closed because it has been stalled for 30+7 days with no activity.