gobuffalo / buffalo

Rapid Web Development w/ Go
http://gobuffalo.io
MIT License
8.06k stars 573 forks source link

JSON rendering errors on authenticity_token #1934

Closed ghost closed 4 years ago

ghost commented 4 years ago

I've added JSON rendering to a action handler here. This resource was generated with pop support disabled. When I query the endpoint with Accept: application/json, it 500s with the response {"error":"application.plush.html: line 9: \"authenticity_token\": unknown identifier","trace":"application.plush.html: line 9: \"authenticity_token\": unknown identifier","code":500}. I don't understand why plush is involved.

``` [brad@workstation factorio]$ buffalo info -> 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.13.9, meets the minimum requirements. -> Go: Checking Package Management ✓ You are using Go Modules (`go`) for package management. -> Go: Checking PATH ✘ Your PATH (.:/home/brad/bin:.:/home/brad/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games) does not conta in /home/brad/go/bin. Without /home/brad/go/bin in your `PATH` any Go executables can not be run globally. For help setting up your Go environment please follow the instructions for you platform at: https://www.gopherguides.com/courses/preparing-your-environment-for-go-development -> Node: Checking installation ✓ The `node` executable was found on your system at: /usr/bin/node -> Node: Checking minimum version requirements [116/548] ✓ Your version of Node, v10.17.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, 5.8.0, does not meet the minimum requirements. Minimum versions of NPM are: * >=6.0.0 * >=7.0.0 For help setting up your NPM environment please follow the instructions for you platform at: https://docs.npmjs.com/getting-started/configuring-your-local-environment -> Yarn: Checking installation ✓ The `yarnpkg` executable was found on your system at: /usr/bin/yarnpkg -> Yarn: Checking minimum version requirements ✓ Your version of Yarn, 1.19.1, meets the minimum requirements. -> PostgreSQL: Checking installation ✘ The `postgres` executable could not be found on your system. For help setting up your Postgres environment please follow the instructions for you platform at: https://www.postgresql.org/download/ -> 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 could not be found on your system. For help setting up your SQLite3 environment please follow the instructions for you platform at: https://www.sqlite.org/download.html -> 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: /usr/local/bin/buffalo -> Buffalo (CLI): Checking minimum version requirements ✓ Your version of Buffalo (CLI), v0.16.1, meets the minimum requirements. -> Buffalo: Application Details Pwd /home/brad/factorio Root /home/brad/factorio GoPath /home/brad/go PackagePkg github.com/bradmwalker/factorio ActionsPkg github.com/bradmwalker/factorio/actions ModelsPkg github.com/bradmwalker/factorio/models GriftsPkg github.com/bradmwalker/factorio/grifts WithModules true Name factorio Bin bin/factorio VCS none WithPop false WithSQLite false WithDep false WithWebpack true WithNodeJs true WithYarn true WithDocker true WithGrifts true AsWeb true AsAPI false [40/548] InApp true PackageJSON {map[build:webpack -p --progress dev:webpack --watch]} -> Buffalo: config/buffalo-app.toml name = "factorio" bin = "bin/factorio" vcs = "none" with_pop = false with_sqlite = false with_dep = false with_webpack = true with_nodejs = true with_yarn = true with_docker = true with_grifts = true as_web = true as_api = false -> Buffalo: config/buffalo-plugins.toml -> Buffalo: go.mod module github.com/bradmwalker/factorio require ( github.com/antchfx/htmlquery v1.2.2 github.com/antchfx/xpath v1.1.4 // indirect github.com/cockroachdb/cockroach-go v0.0.0-20200312223839-f565e4789405 // indirect github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/gobuffalo/buffalo v0.16.1 github.com/gobuffalo/envy v1.9.0 github.com/gobuffalo/mw-csrf v1.0.0 github.com/gobuffalo/mw-forcessl v0.0.0-20200131175327-94b2bd771862 github.com/gobuffalo/mw-i18n v1.0.0 github.com/gobuffalo/mw-paramlogger v1.0.0 github.com/gobuffalo/nulls v0.3.0 // indirect github.com/gobuffalo/packr/v2 v2.8.0 github.com/gobuffalo/suite v2.8.2+incompatible github.com/gobuffalo/validate/v3 v3.2.0 // indirect github.com/gobuffalo/x v0.0.0-20190224155809-6bb134105960 github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/golang/protobuf v1.3.5 // indirect github.com/gorilla/websocket v1.4.2 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.2.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.14.3 // indirect github.com/jackc/pgconn v1.5.0 // indirect github.com/mattn/go-colorable v0.1.6 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect github.com/motemen/go-quickfix v0.0.0-20200118031250-2a6e54e79a50 // indirect github.com/motemen/gore v0.5.0 // indirect github.com/peterh/liner v1.2.0 // indirect github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.5.1 github.com/prometheus/procfs v0.0.11 // indirect github.com/sirupsen/logrus v1.5.0 github.com/spf13/cobra v0.0.7 // indirect github.com/stretchr/testify v1.5.1 github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc // indirect github.com/unrolled/secure v1.0.7 go.etcd.io/bbolt v1.3.4 // indirect go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738 go.uber.org/zap v1.14.1 // indirect golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e // indirect golang.org/x/sys v0.0.0-20200331124033-c3d80250170d // indirect golang.org/x/tools v0.0.0-20200403190813-44a64ad78b9b // indirect google.golang.org/genproto v0.0.0-20200402124713-8ff61da6d932 // indirect google.golang.org/grpc v1.28.0 // indirect k8s.io/api v0.18.0 // indirect k8s.io/apimachinery v0.18.0 k8s.io/client-go v0.0.0-20200402220554-cb664d40f84c ) replace ( go.etcd.io/etcd => go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738 google.golang.org/grpc => google.golang.org/grpc v1.26.0 ) go 1.13 ```
paganotoni commented 4 years ago

@bradmwalker it seems that It's taking the "html" path on that responder block. Can you please share what the request looks like? Thanks for reporting.

ghost commented 4 years ago

I was querying a stale binary. Sorry for the noise.

paganotoni commented 4 years ago

No worries, thanks for reporting anyways.