Runtime error on node registration

I recently set up an instance of Tyk in an Ubuntu VM according to the doc “Install Tyk Pro Edition on Ubuntu”. Everything seems to be set up correctly, but whenever the gateway tries to start, it throws the following error:

==> tyk-gateway.log <==
[Apr 11 14:11:30] ERROR Failed to decode body: json: cannot unmarshal string into Go value of type []main.Policy
[Apr 11 14:11:30]  INFO main: Gateway started (v2.0.0.0)
[Apr 11 14:11:30]  INFO main: --> Listening on port: 8080
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x66ee25]

goroutine 29 [running]:
panic(0xc55920, 0xc82000e070)
	/usr/local/go/src/runtime/panic.go:464 +0x3e6
net/http.(*Server).Serve(0xc820439c80, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/http/server.go:2108 +0x465
net/http.Serve(0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/http/server.go:1976 +0x8e
created by main.main
	/home/tyk/go/src/github.com/lonelycode/tyk/main.go:1210 +0x2bd1
[Apr 11 14:11:30]  INFO Connection dropped, connecting..

Any advice on what might be causing this?

Do you have something else running on the same port? That’s what that panic usually means.

netstat didn’t show anything, but that has to be it. Change the port to 8090 and it’s no longer crashing. Thanks!

1 Like