Repository: gobuffalo/buffalo

Issue #1067: Gorilla securecookie behaviour change breaks buffalo
Created: 2018-05-21T19:18:58Z
Steps to Reproduce the Problem
Please describe in painful detail what you did (so others can play along with you) to get to this point. This includes things like the exact command(s) you used, or the curl command you used, that sort of thing.
Assume you have buffalo in your PATH and Postgres up and running
mkdir -p $GOPATH/src/github.com/dnnrly
$GOPATH/src/github.com/dnnrly
buffalo new buffalo_react
buffalo dev

Go to http://localhost:3000
Expected Behavior
Here I would expect the a fully functioning buffalo based home page.
Actual Behavior
A buffalo error page with the following message:
securecookie: hash key is not set
An example of this can be found at:
https://ci.appveyor.com/project/markbates/buffalo/build/935
Info
Short version, the following commit to github.com/gorilla/securecookie broke things:
gorilla/securecookie@b009e17

Long version:
New project as of 2018-05-21. Putting a `panic` in all places where this error text is generated reveals to following:
goroutine 1 [running]:
github.com/gorilla/securecookie.New(0xee41d8, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc42026f860)
        /home/dnnrly/projects/buffalo-react/src/github.com/gorilla/securecookie/securecookie.go:146 +0x2eb
github.com/gorilla/securecookie.CodecsFromPairs(0xc42026f980, 0x1, 0x1, 0xee41d8, 0x0, 0x0)
        /home/dnnrly/projects/buffalo-react/src/github.com/gorilla/securecookie/securecookie.go:552 +0xff
github.com/gorilla/sessions.NewCookieStore(0xc42026f980, 0x1, 0x1, 0xee41d8)
        /home/dnnrly/projects/buffalo-react/src/github.com/gorilla/sessions/store.go:55 +0x43
github.com/gobuffalo/buffalo.optionsWithDefaults(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc4200240a7, 0xb, 0x0, 0x0, ...)
        /home/dnnrly/projects/buffalo-react/src/github.com/gobuffalo/buffalo/options.go:137 +0x65a
github.com/gobuffalo/buffalo.New(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc4200240a7, 0xb, 0x0, 0x0, ...)
        /home/dnnrly/projects/buffalo-react/src/github.com/gobuffalo/buffalo/app.go:140 +0x6a
github.com/dnnrly/buffalo_react/actions.App(0x0)
        /home/dnnrly/projects/buffalo-react/src/github.com/dnnrly/buffalo_react/actions/app.go:27 +0xd7
main.main()
        /home/dnnrly/projects/buffalo-react/src/github.com/dnnrly/buffalo_react/main.go:10 +0x22
 ===

v0.11.1

### App Information
Pwd=/home/dnnrly/projects/buffalo-react/src/github.com/dnnrly/buffalo_react
Root=/home/dnnrly/projects/buffalo-react/src/github.com/dnnrly/buffalo_react
GoPath=/home/dnnrly/projects/buffalo-react
Name=buffalo_react
Bin=bin/buffalo_react
PackagePkg=github.com/dnnrly/buffalo_react
ActionsPkg=github.com/dnnrly/buffalo_react/actions
ModelsPkg=github.com/dnnrly/buffalo_react/models
GriftsPkg=github.com/dnnrly/buffalo_react/grifts
VCS=git
WithPop=true
WithDep=false
WithWebpack=true
WithYarn=true
WithDocker=true
WithGrifts=true

### Go Version
go version go1.10 linux/amd64

### Go Env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/dnnrly/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/dnnrly/projects/buffalo-react"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build003542475=/tmp/go-build -gno-record-gcc-switches"

### Node Version
v8.9.4

### NPM Version
5.6.0

### Yarn Version
1.5.1

### PostgreSQL Version
PostgreSQL Not Found

### MySQL Version
MySQL Not Found

### SQLite Version
SQLite Not Found

### Dep Version
dep:
 version     : devel
 build date  :
 git hash    :
 go version  : go1.10
 go compiler : gc
 platform    : linux/amd64

### Dep Status
could not find project Gopkg.toml, use dep init to initiate a manifest
Usage:
  buffalo info [flags]

Flags:
  -h, --help   help for info

Duplicate issue #1073: securecookie: hash key is not set Error
Created: 2018-05-24T10:03:23Z
Steps to Reproduce the Problem

go get -u -v -tags sqlite github.com/gobuffalo/buffalo/buffalo
buffalo create --db-type sqlite3
buffalo db create -a
buffalo dev

Expected Behavior
The Server spins up correctly and without any errors
Actual Behavior
I get the following error trace:
securecookie: hash key is not set
I figured this has something to do with securecookie by gorilla, but still i have no clue how to fix this issue.
Context

T: %!s(i18n.TranslateFunc=0x45e12f0)

asciffy: %!s(func(string) string=0x43c0080)

assetPath: %!s(func(string) (string, error)=0x4594040)

authenticity_token: o0N1H7HOQRUTMRp0H/k9pRpkFDcWuvctkt1td5fQj9Q=

between: %!s(func(int, int) plush.Iterator=0x444bfb0)

camelize: %!s(func(string) string=0x43bfba0)

camelize_down_first: %!s(func(string) string=0x43bfc10)

capitalize: %!s(func(string) string=0x43bfb30)

contentFor: %!s(func(string, plush.HelperContext) (template.HTML, error)=0x4449d10)

contentOf: %!s(func(string, plush.HelperContext) template.HTML=0x4449e50)

contentType: text/html

current_path: /

current_route: {
"method": "GET",
"path": "/",
"handler": "github.com/garritfra/hello_buffalo/actions.HomeHandler",
"pathName": "rootPath",
"aliases": []
}

current_template: index.html

dasherize: %!s(func(string) string=0x43bffa0)

debug: %!s(func(interface {}) template.HTML=0x444b940)

downcase: %!s(func(string) string=0x41435b0)

env: development

envOr: %!s(func(string, string) string=0x42e7f90)

flash: map[]

form: %!s(func(tags.Options, plush.HelperContext) (template.HTML, error)=0x444a540)

form_for: %!s(func(interface {}, tags.Options, plush.HelperContext) (template.HTML, error)=0x444a5e0)

groupBy: %!s(func(int, interface {}) (*plush.groupBy, error)=0x444c090)

htmlEscape: %!s(func(string, plush.HelperContext) (string, error)=0x444bad0)

humanize: %!s(func(string) string=0x43bfd60)

imgTag: %!s(func(string, tags.Options) (template.HTML, error)=0x45940f0)

inspect: %!s(func(interface {}) string=0x444ba30)

javascriptTag: %!s(func(string, tags.Options) (template.HTML, error)=0x45940f0)

jsEscape: %!s(func(string) string=0x431e300)

json: %!s(func(interface {}) (template.HTML, error)=0x444b7b0)

languages: [de-DE de en-CA en en-US en-US]

len: %!s(func(interface {}) int=0x444b890)

markdown: %!s(func(string, plush.HelperContext) (template.HTML, error)=0x444c680)

method: GET

ordinalize: %!s(func(string) string=0x43c0010)

paginator: %!s(func(*pop.Paginator, map[string]interface {}, plush.HelperContext) (template.HTML, error)=0x4593c40)

parameterize: %!s(func(string) string=0x43bfe40)

params: map[]

partial: %!s(func(string, render.Data) (template.HTML, error)=0x4594690)

pluralize: %!s(func(string) string=0x43bf9e0)

pluralize_with_size: %!s(func(string, int) string=0x43bfa50)

range: %!s(func(int, int) plush.Iterator=0x444bf40)

raw: %!s(func(string) template.HTML=0x444d9e0)

request: &{GET / HTTP/1.1 %!s(int=1) %!s(int=1) map[Connection:[keep-alive] Cache-Control:[max-age=0] Upgrade-Insecure-Requests:[1] User-Agent:[Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36] Accept:[text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8] Accept-Language:[de-DE,de;q=0.9,en-CA;q=0.8,en;q=0.7,en-US;q=0.6] Cookie:[username-localhost-8888="2|1:0|10:1526146027|23:username-localhost-8888|44:MWY3NWM1YzA4ODc3NGI0ZmE2NTYwNWM2NjI4NjNlYjU=|fbcaa5e492d70cd0f7b6699c3b46204f213e485f7d009fbac0ef26d9d633aab3"; _xsrf=2|43e41d15|f3ebf20d21f9e16614fc6a6c12dc8d01|1526146027] Accept-Encoding:[gzip, deflate, br]] {} %!s(func() (io.ReadCloser, error)=<nil>) %!s(int64=0) [] %!s(bool=false) localhost:3000 map[] map[] %!s(*multipart.Form=<nil>) map[] 127.0.0.1:57827 / %!s(*tls.ConnectionState=<nil>) %!s(<-chan struct {}=<nil>) %!s(*http.Response=<nil>) %!s(*context.valueCtx=&{0xc4201b3e90 1 0xc4203862d0})}

request_id: 8075766137-0b9d0486f4

session: &{%!s(*sessions.Session=&{ map[authenticity_token:[84 82 250 123 95 90 223 167 124 32 97 85 38 17 133 183 81 204 231 247 91 228 164 102 147 52 25 243 213 152 225 242] _flash_:[123 125] requestor_id:8075766137] 0xc4203f4000 true 0xc42036e340 _hello_buffalo_session}) %!s(*http.Request=&{GET 0xc42032e480 HTTP/1.1 1 1 map[Accept-Encoding:[gzip, deflate, br] Accept-Language:[de-DE,de;q=0.9,en-CA;q=0.8,en;q=0.7,en-US;q=0.6] Cookie:[username-localhost-8888="2|1:0|10:1526146027|23:username-localhost-8888|44:MWY3NWM1YzA4ODc3NGI0ZmE2NTYwNWM2NjI4NjNlYjU=|fbcaa5e492d70cd0f7b6699c3b46204f213e485f7d009fbac0ef26d9d633aab3"; _xsrf=2|43e41d15|f3ebf20d21f9e16614fc6a6c12dc8d01|1526146027] Connection:[keep-alive] Cache-Control:[max-age=0] Upgrade-Insecure-Requests:[1] User-Agent:[Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36] Accept:[text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8]] {} <nil> 0 [] false localhost:3000 map[] map[] <nil> map[] 127.0.0.1:57827 / <nil> <nil> <nil> 0xc4201b3ec0}) %!s(*buffalo.Response=&{500 6953 0xc4203f0000})}

singularize: %!s(func(string) string=0x43bfac0)

status: %!s(int=200)

stylesheetTag: %!s(func(string, tags.Options) (template.HTML, error)=0x45940f0)

t: %!s(func(string, ...interface {}) string=0x45e27e0)

tableize: %!s(func(string) string=0x43bfdd0)

truncate: %!s(func(string, map[string]interface {}) string=0x444bbb0)

tx: /Users/garritfra/Documents/dev/go/src/github.com/garritfra/hello_buffalo_development.sqlite?_busy_timeout=5000

typeify: %!s(func(string) string=0x43bff30)

underscore: %!s(func(string) string=0x43bfcf0)

until: %!s(func(int) plush.Iterator=0x444c020)

upcase: %!s(func(string) string=0x4143450)

yield: <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Buffalo - Hello Buffalo</title>
<link href="/assets/application.css" media="screen" rel="stylesheet" />
<meta name="csrf-param" content="authenticity_token" />
<meta name="csrf-token" content="o0N1H7HOQRUTMRp0H/k9pRpkFDcWuvctkt1td5fQj9Q=" />
<link rel="icon" href="/assets/images/favicon.ico">
</head>
<body>

<div class="container">

<style media="screen">
* {
-webkit-transition: all .38s;
/* Safari */
transition: all .38s;
}

.container {
min-width: 320px;
}

header {
background-color: #62a5ee;
padding: 10px 20px;
box-sizing: border-box;
}

.logo img {
width: 80px;
}

.titles h1 {
font-size: 30px;
font-weight: 300;
color: white;
margin-bottom: 13px;
margin-top: 5px;
}

.titles h2 {
font-weight: 300;
font-size: 18px;
display: inline-block;
margin: 0;
}

.titles a {
color: white;
text-decoration: underline;
}

.titles i {
margin-right: 5px;
text-decoration: none;
}

.titles .documentation {
margin-left: 28px;
}

.subtitle {
color: white;
margin: 0;
padding: 13px 0;
background-color: #2a3543;
margin-bottom: 20px;
}

.subtitle h3 {
font-size: 22px;
font-weight: 400;
margin: 0;
}

table {
font-size: 14px;
}

table.table tbody tr td {
border-top: 0;
padding: 10px;
}

.foot {
text-align: right;
text-align: right;
color: #c5c5c5;
font-weight: 300;
}

.foot a {
color: #8b8b8b;
text-decoration: underline;
}

.centered {
text-align: center;
}

@media all and (max-width: 770px) {
.titles h1 {
font-size: 25px;
margin: 15px 0 5px 0;
}
}

@media all and (max-width: 640px) {
.titles h1 {
font-size: 23px;
margin: 15px 0 5px 0;
}
.titles h2 {
font-size: 15px;
}
.titles .documentation {
margin-left: 10px;
}
}

@media all and (max-width: 530px) {
.titles h1 {
font-size: 20px;
margin: 5px 0;
}
.logo {
padding: 0
}
.logo img {
width: 100%
}
.titles .documentation {
margin-left: 0px;
margin-top: 5px;
display: block;
}
}
</style>

<header>
<div class="container">
<div class="row">
<div class="col-md-1 col-sm-2 col-xs-2 logo">
<a href="/"><img src="/assets/images/logo.svg" alt=""></a>
</div>
<div class="col-md-9 col-sm-9 col-xs-10 titles">
<h1>Welcome to Buffalo (EN) [v0.11.1]</h1>
<h2>
<a href="https://github.com/gobuffalo/buffalo"><i class="fa fa-github" aria-hidden="true"></i> https://github.com/gobuffalo/buffalo</a>
</h2>
<h2 class="documentation">
<a href="http://gobuffalo.io/"><i class="fa fa-book" aria-hidden="true"></i> Documentation</a>
</h2>
</div>
</div>
</div>

</header>

<div class="row">
<div class="col-md-12">
<div class="subtitle">
<div class="container">
<h3>Defined Routes</h3>
</div>
</div>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr text-align="left">
<th class="centered">METHOD</th>
<th>PATH</th>
<th>NAME</th>
<th>HANDLER</th>
</tr>
</thead>
<tbody>


<tr>
<td class="centered">
GET
</td>
<td>

<a href="/">/</a>

</td>
<td>
rootPath
</td>
<td><code>github.com/garritfra/hello_buffalo/actions.HomeHandler</code></td>
</tr>

<tr>
<td class="centered">
GET
</td>
<td>

<a href="/widgets">/widgets</a>

</td>
<td>
widgetsPath
</td>
<td><code>github.com/garritfra/hello_buffalo/actions.WidgetsResource.List</code></td>
</tr>

<tr>
<td class="centered">
POST
</td>
<td>

/widgets

</td>
<td>
widgetsPath
</td>
<td><code>github.com/garritfra/hello_buffalo/actions.WidgetsResource.Create</code></td>
</tr>

<tr>
<td class="centered">
GET
</td>
<td>

<a href="/widgets/new">/widgets/new</a>

</td>
<td>
newWidgetsPath
</td>
<td><code>github.com/garritfra/hello_buffalo/actions.WidgetsResource.New</code></td>
</tr>

<tr>
<td class="centered">
GET
</td>
<td>

/widgets/{widget_id}

</td>
<td>
widgetPath
</td>
<td><code>github.com/garritfra/hello_buffalo/actions.WidgetsResource.Show</code></td>
</tr>

<tr>
<td class="centered">
PUT
</td>
<td>

/widgets/{widget_id}

</td>
<td>
widgetPath
</td>
<td><code>github.com/garritfra/hello_buffalo/actions.WidgetsResource.Update</code></td>
</tr>

<tr>
<td class="centered">
DELETE
</td>
<td>

/widgets/{widget_id}

</td>
<td>
widgetPath
</td>
<td><code>github.com/garritfra/hello_buffalo/actions.WidgetsResource.Destroy</code></td>
</tr>

<tr>
<td class="centered">
GET
</td>
<td>

/widgets/{widget_id}/edit

</td>
<td>
editWidgetPath
</td>
<td><code>github.com/garritfra/hello_buffalo/actions.WidgetsResource.Edit</code></td>
</tr>


</tbody>
</table>
</div>
</div>
</div>
<div class="foot"> <span> Powered by <a href="http://gobuffalo.io/">gobuffalo.io</a></span> </div>

</div>

<script src="/assets/application.js" type="text/javascript"></script>
</body>
</html>


Headers

´´´
Accept-Language: [de-DE,de;q=0.9,en-CA;q=0.8,en;q=0.7,en-US;q=0.6]
Accept: [text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8]
Cache-Control: [max-age=0]
Connection: [keep-alive]
Cookie: [username-localhost-8888="2|1:0|10:1526146027|23:username-localhost-8888|44:MWY3NWM1YzA4ODc3NGI0ZmE2NTYwNWM2NjI4NjNlYjU=|fbcaa5e492d70cd0f7b6699c3b46204f213e485f7d009fbac0ef26d9d633aab3"; _xsrf=2|43e41d15|f3ebf20d21f9e16614fc6a6c12dc8d01|1526146027]
Upgrade-Insecure-Requests: [1]
User-Agent: [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36]
´´´

Info
Please run buffalo info and paste the information below where it says "PASTE_HERE".

### Buffalo Version
v0.11.1

### App Information
Pwd=/Users/garritfra/Documents/dev/go/src/github.com/garritfra/hello_buffalo
Root=/Users/garritfra/Documents/dev/go/src/github.com/garritfra/hello_buffalo
GoPath=/Users/garritfra/Documents/dev/go
Name=hello_buffalo
Bin=bin/hello_buffalo
PackagePkg=github.com/garritfra/hello_buffalo
ActionsPkg=github.com/garritfra/hello_buffalo/actions
ModelsPkg=github.com/garritfra/hello_buffalo/models
GriftsPkg=github.com/garritfra/hello_buffalo/grifts
VCS=git
WithPop=true
WithDep=false
WithWebpack=true
WithYarn=false
WithDocker=true
WithGrifts=true

### Go Version
go version go1.10.2 darwin/amd64

### Go Env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/garritfra/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/garritfra/Documents/dev/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/8_/2vlm_82n4g30sjv9py30x9wc0000gn/T/go-build143983300=/tmp/go-build -gno-record-gcc-switches -fno-common"

### Node Version
v8.9.4

### NPM Version
5.6.0


   ╭─────────────────────────────────────╮
   │                                     │
   │   Update available 5.6.0 → 6.0.1    │
   │     Run npm i -g npm to update      │
   │                                     │
   ╰─────────────────────────────────────╯


### Yarn Version
1.3.2

### PostgreSQL Version
PostgreSQL Not Found

### MySQL Version
MySQL Not Found

### SQLite Version
3.19.3 2017-06-27 16:48:08 2b0954060fe10d6de6d479287dd88890f1bef6cc1beca11bc6cdb79f72e2377b

### Dep Version
dep Not Found

### Dep Status
dep Not Found

Closing comment (2018-05-24T10:20:48Z): Duplicate of #1067