XanderStrike / goplaxt

Scrobble Plex plays to Trakt with ease!
MIT License
301 stars 35 forks source link

Runtime error: json: cannot unmarshal array into Go struct field #67

Closed OppiM closed 2 years ago

OppiM commented 2 years ago

Hi,

using self-hosted plaxt on docker and the latest Plex server (Version 1.25.5.5492).

When Plex sends a webhook I get this error:

2022/02/14 18:02:07 http: panic serving 192.168.18.23:57762: json: cannot unmarshal array into Go struct field Metadata.Rating of type float32
goroutine 26 [running]:
net/http.(*conn).serve.func1(0xc0001d2000)
        /usr/local/go/src/net/http/server.go:1769 +0x139
panic(0x856780, 0xc0000bc190)
        /usr/local/go/src/runtime/panic.go:522 +0x1b5
main.api(0x985ee0, 0xc00043c1c0, 0xc0000fc600)
        /go/src/github.com/xanderstrike/goplaxt/main.go:112 +0xc84
net/http.HandlerFunc.ServeHTTP(0x901c38, 0x985ee0, 0xc00043c1c0, 0xc0000fc600)
        /usr/local/go/src/net/http/server.go:1995 +0x44
github.com/gorilla/handlers.ProxyHeaders.func1(0x985ee0, 0xc00043c1c0, 0xc0000fc600)
        /go/pkg/mod/github.com/gorilla/handlers@v1.5.1/proxy_headers.go:59 +0x10d
net/http.HandlerFunc.ServeHTTP(0xc000432160, 0x985ee0, 0xc00043c1c0, 0xc0000fc600)
        /usr/local/go/src/net/http/server.go:1995 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0000ba0c0, 0x985ee0, 0xc00043c1c0, 0xc0000fc400)
        /go/pkg/mod/github.com/gorilla/mux@v1.8.0/mux.go:210 +0xe3
net/http.serverHandler.ServeHTTP(0xc000090b60, 0x985ee0, 0xc00043c1c0, 0xc0000fc400)
        /usr/local/go/src/net/http/server.go:2774 +0xa8
net/http.(*conn).serve(0xc0001d2000, 0x986a20, 0xc000268480)
        /usr/local/go/src/net/http/server.go:1878 +0x851
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:2884 +0x2f4

Regards, Michael

geaston95 commented 2 years ago

Having same issue, are there any fixes for this?

meme1337 commented 2 years ago

Same issue here.

abjugard commented 2 years ago

Same issue. @XanderStrike any chance you can look at this? Sounds like a data structure has been changed in the Plex webhooks API.

EDIT: Holy shit I didn't realise there's literally no documentation for Plex webhooks. What's up with that @plexinc?

EDIT: I've "fixed" it in this pull request: https://github.com/XanderStrike/plexhooks/pull/3

abjugard commented 2 years ago

This issue is now fixed in the latest official images. Should be closed @XanderStrike.