hashi-ui icon indicating copy to clipboard operation
hashi-ui copied to clipboard

Crash on bad payload on api

Open LordFPL opened this issue 6 years ago • 1 comments

Hello,

Thx for all your work, hashi-ui is really usefull for me :+1: :)

I made upgrade to 0.22.0 and discover the api... a few tests are ok... but i see a crash when i do a :

curl -s https://my-hashi-ui-url/api/nomad/global -d '{"type":"NOMAD_WATCH_NODE"}'

"S" on NODE was missing... but on server side, this little mistake was a little more critical :

panic: interface conversion: interface {} is nil, not string

goroutine 1348 [running]:
github.com/jippi/hashi-ui/backend/nomad/nodes.(*info).id(...)
	/home/travis/gopath/src/github.com/jippi/hashi-ui/backend/nomad/nodes/info.go:56
github.com/jippi/hashi-ui/backend/nomad/nodes.(*info).Key(0xc420223600, 0xdf7b20, 0xc42031fda0)
	/home/travis/gopath/src/github.com/jippi/hashi-ui/backend/nomad/nodes/info.go:44 +0xba
github.com/jippi/hashi-ui/backend/subscriber.Watch(0xdf87e0, 0xc420223600, 0xdf69e0, 0xc42037eaf0, 0xc42037eaa0, 0xc420494c60, 0xc42074a9c0)
	/home/travis/gopath/src/github.com/jippi/hashi-ui/backend/subscriber/functions.go:31 +0x4c
created by main.(*connection).watch
	/home/travis/gopath/src/github.com/jippi/hashi-ui/backend/connection.go:437 +0xa4
time="2017-10-13T15:04:13+02:00" level=error msg="No longer subscribed to /allocation/877f24a7-051f-ed2b-4a67-6ce67a8de6e2/stream?file=/alloc/logs/hashi-ui-task.stderr.0" connection_id=bafc3956 source=connection

LordFPL avatar Oct 13 '17 13:10 LordFPL

@LordFPL oh yeah, i've been super amazing lazy with that part of the code so far, since i controlled everything from JS :)

I / someone should go through all of the actions and make them more safe for errors :)

jippi avatar Oct 13 '17 14:10 jippi