hippware / wocky

Server side (Erlang/Elixir) software
13 stars 3 forks source link

[Wocky/next] Protocol.UndefinedError: protocol String.Chars not implemented for %FunctionClauseError{args: nil, arity: 2, clauses: nil, function: :time_within_drift?, kind: nil, module: Guardian.Token.Verify}. This protocol is implemented for: Atom, BitString, Date, DateTime, Decimal, Float, Geo.GeometryCollection, Geo.LineString, Geo.MultiLineString, Geo.MultiPoint, Geo.MultiPolygon, Geo.Point, Geo.PointM, Geo.PointZ, Geo.PointZM, Geo.Polygon, Integer, List, NaiveDateTime, Postgrex.Copy, Postgrex.Query,... #2161

Closed bernardd closed 5 years ago

bernardd commented 5 years ago

Backtrace

View full backtrace and more info at honeybadger.io

bernardd commented 5 years ago

Loggly data:

2019-01-15 05:50:21.000
{ json: { msg: "GenServer #PID<0.31739.1> terminating ** (Protocol.UndefinedError) protocol String.Chars not implemented for %FunctionClauseError{args: nil, arity: 2, clauses: nil, function: :time_within_drift?, kind: nil, module: Guardian.Token.Verify}. This protocol is implemented for: Atom, BitString, Date, DateTime, Decimal, Float, Geo.GeometryCollection, Geo.LineString, Geo.MultiLineString, Geo.MultiPoint, Geo.MultiPolygon, Geo.Point, Geo.PointM, Geo.PointZ, Geo.PointZM, Geo.Polygon, Integer, List, NaiveDateTime, Postgrex.Copy, Postgrex.Query, Time, URI, Version, Version.Requirement (elixir) /tmp/elixir-build/elixir/lib/elixir/lib/string/chars.ex:3: String.Chars.impl_for!/1 (elixir) /tmp/elixir-build/elixir/lib/elixir/lib/string/chars.ex:22: String.Chars.to_string/1 (wocky) lib/wocky/account/account.ex:66: Wocky.Account.authenticate/1 (wocky_api) lib/wocky_api/resolvers/auth.ex:7: WockyAPI.Resolvers.Auth.authenticate/3 (absinthe) lib/absinthe/resolution.ex:209: Absinthe.Resolution.call/2 (absinthe) lib/absinthe/phase/document/execution/resolution.ex:229: Absinthe.Phase.Document.Execution.Resolution.reduce_resolution/1 (absinthe) lib/absinthe/phase/document/execution/resolution.ex:184: Absinthe.Phase.Document.Execution.Resolution.do_resolve_field/3 (absinthe) lib/absinthe/phase/document/execution/resolution.ex:169: Absinthe.Phase.Document.Execution.Resolution.do_resolve_fields/6 Last message: %Phoenix.Socket.Message{event: "doc", join_ref: "1", payload: %{"query" => "mutation authenticate($token: String!) {\n authenticate(input: {token: $token}) {\n user {\n id\n __typename\n }\n __typename\n }\n}\n", "variables" => %{"token" => "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJXb2NreSIsImp0aSI6IjcwYzNmZjMwLTE4ODktMTFlOS04YjFmLWI3NTBlZmFlYTQzZSIsImlzcyI6IlRpbnlSb2JvdC80LjAuMSAoaU9TIDExLjQ7IGlQaG9uZTksMSkiLCJkdmMiOiI4ODM4QUU0Qi1CMjVDLTRDREUtQjczQS0yNEY0M0JDODM2QUIiLCJpYXQiOjE1NDc1MzE0MTkuMjk5LCJ0eXAiOiJieWFzcyIsInN1YiI6IisxNTU1MDI1NjYzIiwicGhvbmVfbnVtYmVyIjoiKzE1NTUwMjU2NjMifQ.81mRVt5Vvfqfa0JVxfopUXVwqibvJeUeVeHvNIJ67Up9iuohDusDL3zRinQzFA-gcECohAihD5m8t4SUJ86OVA"}}, ref: "2", topic: "__absinthe__:control"}", kubernetes: { container_name: "wocky", host: "ip-10-1-62-41.us-west-2.compute.internal", master_url: "https://172.20.0.1:443/api", pod_id: "afbdf80a-1427-11e9-8e2b-0201ca26510c", namespace_name: "wocky-next", pod_name: "wocky-6d595d555b-nb6mn", labels: { app: "wocky", pod-template-hash: "2815181116", env: "next" } }, level: "error", log: "{"time":"2019-01-15 05:50:21.461","pid":"#PID<0.31739.1>","msg":"GenServer #PID<0.31739.1> terminating\n** (Protocol.UndefinedError) protocol String.Chars not implemented for %FunctionClauseError{args: nil, arity: 2, clauses: nil, function: :time_within_drift?, kind: nil, module: Guardian.Token.Verify}. This protocol is implemented for: Atom, BitString, Date, DateTime, Decimal, Float, Geo.GeometryCollection, Geo.LineString, Geo.MultiLineString, Geo.MultiPoint, Geo.MultiPolygon, Geo.Point, Geo.PointM, Geo.PointZ, Geo.PointZM, Geo.Polygon, Integer, List, NaiveDateTime, Postgrex.Copy, Postgrex.Query, Time, URI, Version, Version.Requirement\n (elixir) /tmp/elixir-build/elixir/lib/elixir/lib/string/chars.ex:3: String.Chars.impl_for!/1\n (elixir) /tmp/elixir-build/elixir/lib/elixir/lib/string/chars.ex:22: String.Chars.to_string/1\n (wocky) lib/wocky/account/account.ex:66: Wocky.Account.authenticate/1\n (wocky_api) lib/wocky_api/resolvers/auth.ex:7: WockyAPI.Resolvers.Auth.authenticate/3\n (absinthe) lib/absinthe/resolution.ex:209: Absinthe.Resolution.call/2\n (absinthe) lib/absinthe/phase/document/execution/resolution.ex:229: Absinthe.Phase.Document.Execution.Resolution.reduce_resolution/1\n (absinthe) lib/absinthe/phase/document/execution/resolution.ex:184: Absinthe.Phase.Document.Execution.Resolution.do_resolve_field/3\n (absinthe) lib/absinthe/phase/document/execution/resolution.ex:169: Absinthe.Phase.Document.Execution.Resolution.do_resolve_fields/6\nLast message: %Phoenix.Socket.Message{event: \"doc\", join_ref: \"1\", payload: %{\"query\" => \"mutation authenticate($token: String!) {\\n authenticate(input: {token: $token}) {\\n user {\\n id\\n __typename\\n }\\n __typename\\n }\\n}\\n\", \"variables\" => %{\"token\" => \"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJXb2NreSIsImp0aSI6IjcwYzNmZjMwLTE4ODktMTFlOS04YjFmLWI3NTBlZmFlYTQzZSIsImlzcyI6IlRpbnlSb2JvdC80LjAuMSAoaU9TIDExLjQ7IGlQaG9uZTksMSkiLCJkdmMiOiI4ODM4QUU0Qi1CMjVDLTRDREUtQjczQS0yNEY0M0JDODM2QUIiLCJpYXQiOjE1NDc1MzE0MTkuMjk5LCJ0eXAiOiJieWFzcyIsInN1YiI6IisxNTU1MDI1NjYzIiwicGhvbmVfbnVtYmVyIjoiKzE1NTUwMjU2NjMifQ.81mRVt5Vvfqfa0JVxfopUXVwqibvJeUeVeHvNIJ67Up9iuohDusDL3zRinQzFA-gcECohAihD5m8t4SUJ86OVA\"}}, ref: \"2\", topic: \"__absinthe__:control\"}","module":"gen_server","line":888,"level":"error","function":"error_info/7","file":"gen_server.erl"} ", line: 888, module: "gen_server", pid: "#PID<0.31739.1>", docker: { container_id: "8e38d29d594f567018bcd1cb610c9d5b05bc769ed1950d56db1a32d15f65e186" }, file: "gen_server.erl", stream: "stdout", function: "error_info/7", time: "2019-01-15 05:50:21.461", timestamp: "2019-01-15T05:50:21+00:00" }, http: { contentType: "text" } }
bernardd commented 5 years ago

I'll give you first stab at this one @toland since it's down in the guts of auth.

bengtan commented 5 years ago

I sent the server a JWT token with iat=1547531419.299. That's a timestamp field, and I guess the server choked on the decimal places when it was expecting an integer.

https://hippware.slack.com/archives/C8ABWRT2Q/p1547532011002800

toland commented 5 years ago

The auth code failed properly but then crashed trying to format the exception for the client. I have a fix ready.