Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

New Command generates invalid app settings #540

Closed
paganotoni opened this issue Jul 18, 2017 · 7 comments
Closed

New Command generates invalid app settings #540

paganotoni opened this issue Jul 18, 2017 · 7 comments
Milestone

Comments

@paganotoni
Copy link
Member

If you generate an app from $GOPATH/src with its complete source name the app won't start:

$ cd $GOPATH/src
$ buffalo g new github.com/apaganobeleno/other_app
$ cd github.com/apaganobeleno/other_app
$ buffalo dev

App starts but when you go to localhost:3000 it crashes with:

time="2017-07-18T14:45:08-04:00" level=error msg="runtime error: invalid memory address or nil pointer dereference" 
2017/07/18 14:45:08 http: panic serving [::1]:63974: runtime error: invalid memory address or nil pointer dereference
goroutine 7 [running]:
net/http.(*conn).serve.func1(0xc420261220)
	/usr/local/go/src/net/http/server.go:1721 +0xd0
panic(0x472bec0, 0x4b1a5b0)
	/usr/local/go/src/runtime/panic.go:489 +0x2cf
github.com/apaganobeleno/other/vendor/github.com/gobuffalo/buffalo.Flash.persist(0xc420279920, 0xc420288200)
	/Users/antoniopagano/go/src/github.com/apaganobeleno/other/vendor/github.com/gobuffalo/buffalo/flash.go:41 +0x100
github.com/apaganobeleno/other/vendor/github.com/gobuffalo/buffalo.RouteInfo.ServeHTTP(0x47ca90f, 0x3, 0x47ca25e, 0x1, 0x4ac4158, 0x32, 0x0, 0x47f4198, 0x0, 0x0, ...)
	/Users/antoniopagano/go/src/github.com/apaganobeleno/other/vendor/github.com/gobuffalo/buffalo/handler.go:90 +0x1ba
github.com/apaganobeleno/other/vendor/github.com/gobuffalo/buffalo.(*RouteInfo).ServeHTTP(0xc420284120, 0x4aea120, 0xc420288160, 0xc4202a4000)
	<autogenerated>:41 +0x96
github.com/apaganobeleno/other/vendor/github.com/gorilla/mux.(*Router).ServeHTTP(0xc420019630, 0x4aea120, 0xc420288160, 0xc4202a4000)
	/Users/antoniopagano/go/src/github.com/apaganobeleno/other/vendor/github.com/gorilla/mux/mux.go:114 +0x10c
github.com/apaganobeleno/other/vendor/github.com/markbates/refresh/refresh/web.ErrorChecker.func1(0x4aea120, 0xc420288160, 0xc420239b00)
	/Users/antoniopagano/go/src/github.com/apaganobeleno/other/vendor/github.com/markbates/refresh/refresh/web/web.go:23 +0xc0
net/http.HandlerFunc.ServeHTTP(0xc420288180, 0x4aea120, 0xc420288160, 0xc420239b00)
	/usr/local/go/src/net/http/server.go:1942 +0x44
github.com/apaganobeleno/other/vendor/github.com/gobuffalo/buffalo.(*App).ServeHTTP(0xc420187b00, 0x4aeb6e0, 0xc420192380, 0xc420239b00)
	/Users/antoniopagano/go/src/github.com/apaganobeleno/other/vendor/github.com/gobuffalo/buffalo/app.go:108 +0x100
net/http.serverHandler.ServeHTTP(0xc420190a50, 0x4aeb6e0, 0xc420192380, 0xc420239b00)
	/usr/local/go/src/net/http/server.go:2568 +0x92
net/http.(*conn).serve(0xc420261220, 0x4aebe60, 0xc42027c480)
	/usr/local/go/src/net/http/server.go:1825 +0x612
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:2668 +0x2ce
^CShutting down application
@paganotoni
Copy link
Member Author

Also database.yml uses the complete name of the app instead of the last part:

development:
  dialect: postgres
  database: github.com/apaganobeleno/other_development
  user: postgres
  password: postgres
  host: 127.0.0.1
  pool: 5

test:
  url: {{envOr "TEST_DATABASE_URL" "postgres://postgres:[email protected]:5432/github.com/apaganobeleno/other_test?sslmode=disable"}}

production:
  url: {{envOr "DATABASE_URL" "postgres://postgres:[email protected]:5432/github.com/apaganobeleno/other_production?sslmode=disable

This ends up causing connection string to postgresql is invalid.

@paganotoni
Copy link
Member Author

paganotoni commented Jul 18, 2017

And the issue lucas was having was because the session names was being set to be:

SessionName: "_github.com/apaganobeleno/other_app",

And that seems not to work.

@markbates
Copy link
Member

Sounds like we have 4 ways to fix this:

  • error if the app name contains "special" characters
  • create the app at $PWD/other_app and forget everything that came before it
  • try to create the app at $GOPATH/src/github.com/apaganobeleno/other_app
  • create the app at $PWD/github.com/apaganobeleno/other_app

@apaganobeleno thoughts?

@paganotoni
Copy link
Member Author

@markbates first one sounds cleaner and simpler to me, second could be confusing because we're generating app in a different path than provided by the user, third and fourth have the problem that even tho buffalo have generated the app at the specified path, the user is not even close to that path and will need to do a cd github.com/... before starting to use it which again is confusing.

So my vote is for #1 and warn them we do not accept special characters on the app name.

@markbates
Copy link
Member

works for me! you want to take this one, or should I?

@paganotoni
Copy link
Member Author

i'll work on it tonight, i think this one should be in our next release, agree ?

@markbates
Copy link
Member

yeah. it shouldn't take too long. there's already some logic around what is a "valid" name when creating a new app. just needs to be extended a bit.

@markbates markbates added this to the 0.9.2 milestone Jul 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants